Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c2f934d3a |
@@ -1,17 +1,12 @@
|
||||
ENV = 'development'
|
||||
|
||||
# 接口地址
|
||||
# VUE_APP_BASE_API = 'http://192.168.2.202:8000'
|
||||
# VUE_APP_BASE_API = 'http://192.168.2.42:8000'
|
||||
# VUE_APP_BASE_API = 'http://192.168.2.128:8000'
|
||||
# VUE_APP_BASE_API = 'http://192.168.2.133:8000'
|
||||
# 测试
|
||||
VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn'
|
||||
# 生产
|
||||
# VUE_APP_BASE_API = 'https://cashieradmin.sxczgkj.cn'
|
||||
# VUE_APP_BASE_API = 'http://192.168.2.96:8000'
|
||||
# 张松
|
||||
# VUE_APP_BASE_API = 'http://192.168.2.147:8000/'
|
||||
# VUE_APP_BASE_API = 'http://192.168.2.98:8000'
|
||||
VUE_APP_BASE_API = 'http://admintestpapi.sxczgkj.cn'
|
||||
VUE_APP_WS_API = 'ws://192.168.2.128:8000'
|
||||
|
||||
VUE_APP_PHP_API = 'https://kysh.sxczgkj.cn'
|
||||
# 是否启用 babel-plugin-dynamic-import-node插
|
||||
# 是否启用 babel-plugin-dynamic-import-node插件
|
||||
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||
|
||||
@@ -2,12 +2,7 @@ ENV = 'production'
|
||||
|
||||
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
|
||||
# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http
|
||||
# 测试
|
||||
VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn'
|
||||
# 生产
|
||||
# VUE_APP_BASE_API = 'https://cashieradmin.sxczgkj.cn'
|
||||
VUE_APP_BASE_API = 'https://cashieradmin.sxczgkj.cn'
|
||||
# VUE_APP_BASE_API = 'http://192.168.2.98:8000'
|
||||
# 如果接口是 http 形式, wss 需要改为 ws
|
||||
VUE_APP_WS_API = 'wss://123.56.110.252'
|
||||
|
||||
VUE_APP_PHP_API = 'https://kysh.sxczgkj.cn/source'
|
||||
VUE_APP_WS_API = 'wss://123.56.110.252
|
||||
|
||||
@@ -38,13 +38,6 @@ npm run build:prod
|
||||
|
||||
#### 常见问题
|
||||
|
||||
0、运行报错
|
||||
解决方案:
|
||||
```
|
||||
$env:NODE_OPTIONS="--openssl-legacy-provider"
|
||||
```
|
||||
|
||||
|
||||
1、linux 系统在安装依赖的时候会出现 node-sass 无法安装的问题
|
||||
|
||||
解决方案:
|
||||
|
||||
@@ -36,21 +36,16 @@
|
||||
"fuse.js": "3.4.4",
|
||||
"js-beautify": "^1.10.2",
|
||||
"js-cookie": "2.2.0",
|
||||
"js-md5": "^0.8.3",
|
||||
"jsencrypt": "^3.0.0-rc.1",
|
||||
"jszip": "^3.7.1",
|
||||
"lodash": "^4.17.21",
|
||||
"material-components-vue": "^1.2.0",
|
||||
"mavon-editor": "^2.9.1",
|
||||
"normalize.css": "7.0.0",
|
||||
"nprogress": "0.2.0",
|
||||
"path-to-regexp": "2.4.0",
|
||||
"qrcode": "^1.5.3",
|
||||
"qs": "^6.10.1",
|
||||
"reconnecting-websocket": "^4.4.0",
|
||||
"screenfull": "4.2.0",
|
||||
"sortablejs": "^1.15.2",
|
||||
"terser-webpack-plugin": "^4.2.3",
|
||||
"sortablejs": "1.8.4",
|
||||
"vue": "^2.6.14",
|
||||
"vue-amap": "^0.5.10",
|
||||
"vue-clipboard2": "^0.3.3",
|
||||
@@ -83,7 +78,6 @@
|
||||
"babel-jest": "23.6.0",
|
||||
"babel-plugin-dynamic-import-node": "2.3.0",
|
||||
"babel-plugin-transform-remove-console": "^6.9.4",
|
||||
"cache-loader": "^4.1.0",
|
||||
"chalk": "2.4.2",
|
||||
"chokidar": "2.1.5",
|
||||
"compression-webpack-plugin": "5.0.2",
|
||||
|
||||
@@ -5,9 +5,6 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<meta http-equiv="pragram" content="no-cache">
|
||||
<meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate">
|
||||
<meta http-equiv="expires" content="0">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title><%= webpackConfig.name %></title>
|
||||
<script type="text/javascript">
|
||||
|
||||
@@ -15,13 +15,12 @@ export default {
|
||||
高宽分别对应横竖滚动条的尺寸*/
|
||||
::-webkit-scrollbar {
|
||||
width: 4px;
|
||||
height: 4px;
|
||||
}
|
||||
|
||||
/*定义滚动条轨道
|
||||
内阴影+圆角*/
|
||||
::-webkit-scrollbar-track {
|
||||
background-color: #f5f5f5;
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
|
||||
/*定义滑块
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
|
||||
/**
|
||||
* 查询歌曲列表
|
||||
* @returns
|
||||
*/
|
||||
export function tbShopSonglist(params) {
|
||||
return request({
|
||||
url: "/api/tbShopSong",
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...params
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 新增歌曲
|
||||
* @returns
|
||||
*/
|
||||
export function tbShopSongAdd(data) {
|
||||
return request({
|
||||
url: "/api/tbShopSong",
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改歌曲
|
||||
* @returns
|
||||
*/
|
||||
export function tbShopSongEdit(data) {
|
||||
return request({
|
||||
url: "/api/tbShopSong",
|
||||
method: "put",
|
||||
data
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 删除歌曲
|
||||
* @returns
|
||||
*/
|
||||
export function tbShopSongDel(ids) {
|
||||
return request({
|
||||
url: '/api/tbShopSong',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
/**
|
||||
* 增加打印机
|
||||
* @returns
|
||||
*/
|
||||
export function tbPrintMachine(data, method = "post") {
|
||||
return request({
|
||||
url: "/api/tbPrintMachine",
|
||||
method: method,
|
||||
data: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取应用中心列表
|
||||
* @returns
|
||||
*/
|
||||
export function appCenterGet() {
|
||||
return request({
|
||||
url: "/api/appCenter",
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增/编辑酒品
|
||||
* @returns
|
||||
*/
|
||||
export function tbShopStorageGood(data, method = "post") {
|
||||
return request({
|
||||
url: "/api/tbShopStorageGood",
|
||||
method: method,
|
||||
data: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询酒品列表
|
||||
* @returns
|
||||
*/
|
||||
export function tbShopStorageGoodlist(data) {
|
||||
return request({
|
||||
url: "/api/tbShopStorageGood/list",
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增存酒
|
||||
* @returns
|
||||
*/
|
||||
export function storageWin(data) {
|
||||
return request({
|
||||
url: "/api/storage",
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询存酒列表
|
||||
* @returns
|
||||
*/
|
||||
export function storageList(data) {
|
||||
return request({
|
||||
url: "/api/storage/list",
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 存取酒
|
||||
* @returns
|
||||
*/
|
||||
export function storagePut(data) {
|
||||
return request({
|
||||
url: "/api/storage",
|
||||
method: "put",
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询存取酒记录
|
||||
* @returns
|
||||
*/
|
||||
export function recordList(params) {
|
||||
return request({
|
||||
url: "/api/storage/recordList",
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 存酒统计
|
||||
* @returns
|
||||
*/
|
||||
export function countRecord(data) {
|
||||
return request({
|
||||
url: "/api/storage/countRecord",
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1,227 +0,0 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
/**
|
||||
* 查询耗材类型
|
||||
* @returns
|
||||
*/
|
||||
export function gettbConsType(params) {
|
||||
return request({
|
||||
url: '/api/tbConsType',
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增耗材类型
|
||||
* @returns
|
||||
*/
|
||||
export function posttbConsType(data) {
|
||||
return request({
|
||||
url: '/api/tbConsType',
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 修改耗材类型
|
||||
* @returns
|
||||
*/
|
||||
export function puttbConsType(data) {
|
||||
return request({
|
||||
url: '/api/tbConsType',
|
||||
method: "put",
|
||||
data
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 查询耗材信息
|
||||
* @returns
|
||||
*/
|
||||
export function gettbConsInfo(params) {
|
||||
// return request({
|
||||
// url: '/api/tbConsInfo',
|
||||
// method: "get",
|
||||
// params
|
||||
// });
|
||||
return request({
|
||||
url: "/api/viewConInfoFlow",
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 耗材入库
|
||||
* @returns
|
||||
*/
|
||||
export function posttbConsInfostockIn(data) {
|
||||
return request({
|
||||
url: '/api/tbConsInfo/stockIn',
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 修改单位耗材值耗材
|
||||
* @returns
|
||||
*/
|
||||
export function postapitbConsInfo(data) {
|
||||
return request({
|
||||
url: '/api/tbConsInfo',
|
||||
method: "put",
|
||||
data
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 新增耗材信息
|
||||
* @returns
|
||||
*/
|
||||
export function posttbConsInfo(data) {
|
||||
return request({
|
||||
url: '/api/tbConsInfo',
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询查询耗材规格信息
|
||||
* @returns
|
||||
*/
|
||||
export function getviewConSku(params) {
|
||||
return request({
|
||||
url: '/api/viewConSku',
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 查询查询商品规格
|
||||
* @returns
|
||||
*/
|
||||
export function gettbProductSpec(params) {
|
||||
return request({
|
||||
url: '/api/viewProductSkuShop',
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 新增商品规格耗材信息
|
||||
* @returns
|
||||
*/
|
||||
export function posttbProskuCon(data) {
|
||||
return request({
|
||||
url: '/api/tbProskuCon',
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 新增商品规格耗材信息-修改后
|
||||
* @returns
|
||||
*/
|
||||
export function posttbProskuCons(data) {
|
||||
return request({
|
||||
url: '/api/tbProskuCon',
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 修改商品规格耗材信息状态
|
||||
* @returns
|
||||
*/
|
||||
export function puttbProskuCon(data) {
|
||||
return request({
|
||||
url: '/api/tbProskuCon',
|
||||
method: "put",
|
||||
data
|
||||
});
|
||||
}
|
||||
// 编辑单位耗材值
|
||||
// export function puttbProskuCon(data) {
|
||||
// return request({
|
||||
// url: '/api/tbProskuCon',
|
||||
// method: "put",
|
||||
// data
|
||||
// });
|
||||
// }
|
||||
/**
|
||||
* 删除商品规格耗材信息状态
|
||||
* @returns
|
||||
*/
|
||||
export function deletetbProskuCon(data) {
|
||||
return request({
|
||||
url: '/api/tbProskuCon',
|
||||
method: "delete",
|
||||
data
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 查询耗材流水信息
|
||||
* @returns
|
||||
*/
|
||||
export function gettbConsInfoFlow(params) {
|
||||
return request({
|
||||
url: '/api/tbConsInfoFlow',
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 分组查询获取耗材流水信息
|
||||
*/
|
||||
export function viewConInfoFlow(data) {
|
||||
return request({
|
||||
url: "/api/viewConInfoFlow",
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询耗材单位列表
|
||||
*/
|
||||
export function queryTbConUnitInfo(data) {
|
||||
return request({
|
||||
url: "/api/tbConUnit/queryTbConUnitInfo",
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增耗材单位
|
||||
*/
|
||||
export function addtbConUnit(data) {
|
||||
return request({
|
||||
url: '/api/tbConUnit',
|
||||
method: "post",
|
||||
data:{
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 修改耗材单位
|
||||
*/
|
||||
export function edittbConUnit(data) {
|
||||
return request({
|
||||
url: '/api/tbConUnit',
|
||||
method: "put",
|
||||
data:{
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
import request from "@/utils/request";
|
||||
import editor from "mavon-editor";
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @returns
|
||||
*/
|
||||
export function tbShopExtend(params) {
|
||||
return request({
|
||||
url: "/tbShopExtend",
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增单位
|
||||
* @returns
|
||||
*/
|
||||
export function addtbShopExtend(data) {
|
||||
return request({
|
||||
url: `/tbShopExtend`,
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 编辑详情
|
||||
* @returns
|
||||
*/
|
||||
export function edittbShopExtend(data) {
|
||||
return request({
|
||||
url: '/tbShopExtend',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 查询详情
|
||||
* @returns
|
||||
*/
|
||||
export function querytbShopExtend(params) {
|
||||
return request({
|
||||
url: `/tbShopExtend/` + params,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 删除商品
|
||||
* @returns
|
||||
*/
|
||||
export function deletetbShopExtend(params) {
|
||||
return request({
|
||||
url: "/tbShopExtend",
|
||||
method: "delete",
|
||||
params
|
||||
});
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
/**
|
||||
* 查询交班记录
|
||||
* @returns
|
||||
*/
|
||||
export function tbHandoverGet(leng) {
|
||||
return request({
|
||||
url: leng,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
import request from "@/utils/requestPhp";
|
||||
|
||||
// 获取图片分类
|
||||
export function getcommonCategor(data) {
|
||||
return request({
|
||||
url: `/sourcematerial/getcommon-category`,
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 获取图片
|
||||
export function getcommonpicture(data) {
|
||||
return request({
|
||||
url: "/sourcematerial/getcommon-picture",
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
export function storeAddcategory(data) {
|
||||
return request({
|
||||
url: '/sourcematerial/store-addcategory',
|
||||
method: 'post',
|
||||
data: {
|
||||
...data
|
||||
},
|
||||
})
|
||||
}
|
||||
export function addImg(data) {
|
||||
return request({
|
||||
url: '/sourcematerial/add-img',
|
||||
method: 'post',
|
||||
data: {
|
||||
...data
|
||||
},
|
||||
})
|
||||
}
|
||||
// 删除图片
|
||||
export function delimg(data) {
|
||||
return request({
|
||||
url: '/sourcematerial/delimg',
|
||||
method: 'post',
|
||||
data: {
|
||||
...data
|
||||
},
|
||||
})
|
||||
}
|
||||
// 删除类型
|
||||
export function delcate(data) {
|
||||
return request({
|
||||
url: '/sourcematerial/delcate',
|
||||
method: 'post',
|
||||
data: {
|
||||
...data
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import request from "@/utils/request";
|
||||
import request from '@/utils/request'
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
@@ -6,29 +6,12 @@ import request from "@/utils/request";
|
||||
*/
|
||||
export function tbProductGet(params) {
|
||||
return request({
|
||||
url: "/api/tbProduct",
|
||||
method: "get",
|
||||
url: '/api/tbProduct',
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
||||
export function tbProductlist(params) {
|
||||
return request({
|
||||
url: "/api/tbProduct/list",
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 商品分类列表
|
||||
* @returns
|
||||
*/
|
||||
export function tbShopCategoryGet(params) {
|
||||
return request({
|
||||
url: `/api/tbShopCategory`,
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 进销存类型字典
|
||||
* @returns
|
||||
@@ -36,9 +19,9 @@ export function tbShopCategoryGet(params) {
|
||||
export function dictDetail(params) {
|
||||
return request({
|
||||
url: `/api/dictDetail`,
|
||||
method: "get",
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,9 +31,9 @@ export function dictDetail(params) {
|
||||
export function tbProductStockDetail(data) {
|
||||
return request({
|
||||
url: `/api/tbProductStockDetail/stock`,
|
||||
method: "post",
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,9 +43,9 @@ export function tbProductStockDetail(data) {
|
||||
export function tbProductStockDetailSum(params) {
|
||||
return request({
|
||||
url: `/api/tbProductStockDetail/sum`,
|
||||
method: "get",
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,28 +55,21 @@ export function tbProductStockDetailSum(params) {
|
||||
export function tbShopPurveyorGet(params) {
|
||||
return request({
|
||||
url: `/api/tbShopPurveyor`,
|
||||
method: "get",
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
||||
// 供应商列表1
|
||||
export function tbShopPurveyorGets(params) {
|
||||
return request({
|
||||
url: `/api/tbShopPurveyorTransact`,
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加供应商
|
||||
* @returns
|
||||
*/
|
||||
export function tbShopPurveyor(data, method = "post") {
|
||||
export function tbShopPurveyor(data, method = 'post') {
|
||||
return request({
|
||||
url: `/api/tbShopPurveyor`,
|
||||
method: method,
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,9 +79,9 @@ export function tbShopPurveyor(data, method = "post") {
|
||||
export function tbShopPurveyorTransactGet(params) {
|
||||
return request({
|
||||
url: `/api/tbShopPurveyorTransact`,
|
||||
method: "get",
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,18 +91,11 @@ export function tbShopPurveyorTransactGet(params) {
|
||||
export function tbShopPurveyorTransactInfo(data) {
|
||||
return request({
|
||||
url: `/api/tbShopPurveyorTransact/info`,
|
||||
method: "post",
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
}
|
||||
// 付款
|
||||
export function paidAmount(data) {
|
||||
return request({
|
||||
url: `/api/tbShopPurveyorTransact/payTransact`,
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 进货账目汇总(单一供应商)
|
||||
* @returns
|
||||
@@ -134,9 +103,9 @@ export function paidAmount(data) {
|
||||
export function tbShopPurveyorTransactSum(params) {
|
||||
return request({
|
||||
url: `/api/tbShopPurveyorTransact/sum`,
|
||||
method: "get",
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,9 +115,9 @@ export function tbShopPurveyorTransactSum(params) {
|
||||
export function tbProductStockOperateList(data) {
|
||||
return request({
|
||||
url: `/api/tbProductStockOperate/list`,
|
||||
method: "post",
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -158,8 +127,8 @@ export function tbProductStockOperateList(data) {
|
||||
export function tbProductStockOperateDetail(id) {
|
||||
return request({
|
||||
url: `/api/tbProductStockOperate/${id}`,
|
||||
method: "get"
|
||||
});
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,238 +138,9 @@ export function tbProductStockOperateDetail(id) {
|
||||
export function tbProductStockOperateOutAndOn(data) {
|
||||
return request({
|
||||
url: `/api/tbProductStockOperate/outAndOn`,
|
||||
method: "post",
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 库存列表
|
||||
* @returns
|
||||
*/
|
||||
export function stock(params) {
|
||||
return request({
|
||||
url: `/api/stock/v2`,
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
}
|
||||
// 库存列表子集列表
|
||||
export function stocks(params) {
|
||||
return request({
|
||||
url: `/api/stock/sku`,
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 导出数据
|
||||
* @returns
|
||||
*/
|
||||
export function stockdownload(data) {
|
||||
return request({
|
||||
url: "/api/stock/download/v2",
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
},
|
||||
responseType: "blob"
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @returns
|
||||
*/
|
||||
export function stockdoImport(file) {
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
formData.append("shopId", localStorage.getItem("shopId"));
|
||||
return request({
|
||||
url: "/api/stock/doImport/v2",
|
||||
method: "post",
|
||||
data: formData,
|
||||
Headers: {
|
||||
"Content-Type": "multipart/form-data"
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 库存开关
|
||||
* @returns
|
||||
*/
|
||||
export function stockStateChange(params) {
|
||||
return request({
|
||||
url: `/api/stock/isStock`,
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...params
|
||||
}
|
||||
});
|
||||
}
|
||||
// 下架
|
||||
export function stockStateChangess(params) {
|
||||
return request({
|
||||
url: `/api/stock/grounding`,
|
||||
method: "put",
|
||||
params: {
|
||||
...params
|
||||
}
|
||||
});
|
||||
}
|
||||
// 警戒设置
|
||||
export function stockStatewarnLine(params) {
|
||||
return request({
|
||||
url: `/api/stock/warnLine`,
|
||||
method: "put",
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
});
|
||||
}
|
||||
// 共享库存
|
||||
export function stockStateChanges(params) {
|
||||
return request({
|
||||
url: `/api/stock/productStatus`,
|
||||
method: "put",
|
||||
data: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...params
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增盘点
|
||||
* @returns
|
||||
*/
|
||||
export function tbProductStocktakin(data) {
|
||||
return request({
|
||||
url: `/api/tbProductStocktakin`,
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 盘点记录查询
|
||||
* @returns
|
||||
*/
|
||||
export function tbProductStocktakinGet(data) {
|
||||
return request({
|
||||
url: `/api/tbProductStocktakin`,
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
// 账单付款记录
|
||||
export function tbShopPurveyorTransacttransactPayInfos(params) {
|
||||
return request({
|
||||
url: `/api/tbShopPurveyorTransact/transactPayInfos`,
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询耗材信息
|
||||
* @returns
|
||||
*/
|
||||
export function tbConsInfoGet(data) {
|
||||
return request({
|
||||
url: `/api/tbConsInfo`,
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 耗材出入库
|
||||
* @returns
|
||||
*/
|
||||
export function stockInOut(data) {
|
||||
return request({
|
||||
url: `/api/tbConsInfo/stockInOut`,
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增盘点耗材
|
||||
* @returns
|
||||
*/
|
||||
export function tbConCheck(data) {
|
||||
return request({
|
||||
url: `/api/tbConCheck`,
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询盘点耗材
|
||||
* @returns
|
||||
*/
|
||||
export function tbConCheckGet(data) {
|
||||
return request({
|
||||
url: `/api/tbConCheck`,
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 耗材导出
|
||||
* @returns
|
||||
*/
|
||||
export function tbConsInfodownload(data) {
|
||||
return request({
|
||||
url: "/api/tbConsInfo/download",
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
},
|
||||
responseType: "blob"
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入耗材
|
||||
* @returns
|
||||
*/
|
||||
export function tbConsInfoinputStock(file) {
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
formData.append("shopId", localStorage.getItem("shopId"));
|
||||
return request({
|
||||
url: "/api/tbConsInfo/inputStock",
|
||||
method: "post",
|
||||
data: formData,
|
||||
Headers: {
|
||||
"Content-Type": "multipart/form-data"
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,43 +1,35 @@
|
||||
import request from "@/utils/request";
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function login(data) {
|
||||
export function login(username, password, code, uuid) {
|
||||
return request({
|
||||
url: "auth/login",
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
url: 'auth/login',
|
||||
method: 'post',
|
||||
data: {
|
||||
username,
|
||||
password,
|
||||
code,
|
||||
uuid
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function getInfo() {
|
||||
return request({
|
||||
url: "auth/info",
|
||||
method: "get"
|
||||
});
|
||||
url: 'auth/info',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function getCodeImg(header) {
|
||||
return request({
|
||||
url: "auth/code",
|
||||
method: "get"
|
||||
});
|
||||
url: 'auth/code',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function logout() {
|
||||
return request({
|
||||
url: "auth/logout",
|
||||
method: "delete"
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 个人中心 修改密码
|
||||
* @param {*} data
|
||||
* @returns
|
||||
*/
|
||||
export function updatePass(data) {
|
||||
return request({
|
||||
url: "/api/users/updatePass",
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
url: 'auth/logout',
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
|
||||
// 推送店铺消息开关
|
||||
export function shopState(data) {
|
||||
return request({
|
||||
url: "/api/msg/shopState",
|
||||
method: "put",
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
export function msgall(params) {
|
||||
return request({
|
||||
url: "/api/msg/all",
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
export function msginfo(data) {
|
||||
return request({
|
||||
url: '/api/msg/info',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function state(params) {
|
||||
return request({
|
||||
url: "/api/msg/state",
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
export function delmsg(ids) {
|
||||
return request({
|
||||
url: '/api/msg',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import request from "@/utils/request";
|
||||
import request from '@/utils/request'
|
||||
|
||||
/**
|
||||
* 查询订单
|
||||
@@ -7,13 +7,13 @@ import request from "@/utils/request";
|
||||
*/
|
||||
export function tbOrderInfoData(data) {
|
||||
return request({
|
||||
url: "/api/tbOrderInfo/date",
|
||||
method: "post",
|
||||
url: '/api/tbOrderInfo/date',
|
||||
method: 'post',
|
||||
data: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
...data
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -23,14 +23,14 @@ export function tbOrderInfoData(data) {
|
||||
*/
|
||||
export function tbOrderInfoDownload(data) {
|
||||
return request({
|
||||
url: "/api/tbOrderInfo/download",
|
||||
method: "post",
|
||||
url: '/api/tbOrderInfo/download',
|
||||
method: 'post',
|
||||
data: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
...data
|
||||
},
|
||||
responseType: "blob"
|
||||
});
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,8 +41,8 @@ export function tbOrderInfoDownload(data) {
|
||||
export function tbOrderInfoDetail(id) {
|
||||
return request({
|
||||
url: `/api/tbOrderInfo/${id}`,
|
||||
method: "get"
|
||||
});
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,39 +54,10 @@ export function payCount(createdAt) {
|
||||
console.log(createdAt);
|
||||
return request({
|
||||
url: `/api/tbOrderInfo/payCount`,
|
||||
method: "post",
|
||||
method: 'post',
|
||||
data: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
createdAt: createdAt
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单列表
|
||||
* @param {*} createdAt
|
||||
* @returns
|
||||
*/
|
||||
export function tbGroupOrderInfo(params) {
|
||||
return request({
|
||||
url: `/api/tbGroupOrderInfo`,
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...params
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 退单
|
||||
* @param {*} data
|
||||
* @returns
|
||||
*/
|
||||
export function returnGpOrder(data) {
|
||||
return request({
|
||||
url: `/api/tbGroupOrderInfo/returnGpOrder`,
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
/**
|
||||
* 验证码
|
||||
*/
|
||||
export function sendMsg(params) {
|
||||
return request({
|
||||
url: "/api/tbUserInfo/sendMsg",
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
}
|
||||
// 提交表单
|
||||
export function modfiyUserInfo(data) {
|
||||
return request({
|
||||
url: "/api/tbUserInfo/modfiyUserInfo",
|
||||
method: "post",
|
||||
data,
|
||||
});
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import request from "@/utils/request";
|
||||
import request from '@/utils/request'
|
||||
|
||||
/**
|
||||
* 支付方式
|
||||
@@ -6,105 +6,34 @@ import request from "@/utils/request";
|
||||
*/
|
||||
export function tbShopPayTypeGet(params) {
|
||||
return request({
|
||||
url: "/api/tbShopPayType",
|
||||
method: "get",
|
||||
url: '/api/tbShopPayType',
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改/增加支付方式
|
||||
* @returns
|
||||
*/
|
||||
export function tbShopPayType(data, method = "post") {
|
||||
export function tbShopPayType(data, method = 'post') {
|
||||
return request({
|
||||
url: "/api/tbShopPayType",
|
||||
url: '/api/tbShopPayType',
|
||||
method: method,
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 增删改查新增字典
|
||||
* @returns
|
||||
*/
|
||||
export function dict(data, method = "get") {
|
||||
export function dict(data, method = 'get') {
|
||||
return request({
|
||||
url: "/api/dict",
|
||||
url: '/api/dict',
|
||||
method: method,
|
||||
data: data,
|
||||
params: data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典
|
||||
* @returns
|
||||
*/
|
||||
export function dictPut(data) {
|
||||
return request({
|
||||
url: "/api/dict",
|
||||
method: "put",
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增/编辑资源
|
||||
* @returns
|
||||
*/
|
||||
export function tbPlatformDictPostPut(data, method = "post") {
|
||||
return request({
|
||||
url: "/api/tbPlatformDict",
|
||||
method: method,
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 资源列表
|
||||
* @returns
|
||||
*/
|
||||
export function tbPlatformDictGet(params) {
|
||||
return request({
|
||||
url: "/api/tbPlatformDict",
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增团购卷分类
|
||||
* @returns
|
||||
*/
|
||||
export function tbCouponCategoryPostPut(data, method = "post") {
|
||||
return request({
|
||||
url: "/api/tbCouponCategory",
|
||||
method: method,
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询团购卷分类
|
||||
* @returns
|
||||
*/
|
||||
export function tbCouponCategoryGet(params) {
|
||||
return request({
|
||||
url: "/api/tbCouponCategory",
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询资源类别列表
|
||||
* @returns
|
||||
*/
|
||||
export function tbPlatformDictType(params) {
|
||||
return request({
|
||||
url: "/api/tbPlatformDictType",
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
352
src/api/shop.js
352
src/api/shop.js
@@ -1,4 +1,4 @@
|
||||
import request from "@/utils/request";
|
||||
import request from '@/utils/request'
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
@@ -6,10 +6,10 @@ import request from "@/utils/request";
|
||||
*/
|
||||
export function tbProduct(params) {
|
||||
return request({
|
||||
url: "/api/tbProduct",
|
||||
method: "get",
|
||||
url: '/api/tbProduct',
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -18,10 +18,10 @@ export function tbProduct(params) {
|
||||
*/
|
||||
export function tbProductDelete(data) {
|
||||
return request({
|
||||
url: "/api/tbProduct",
|
||||
method: "delete",
|
||||
url: '/api/tbProduct',
|
||||
method: 'delete',
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -30,10 +30,10 @@ export function tbProductDelete(data) {
|
||||
*/
|
||||
export function tbShopUnit(params) {
|
||||
return request({
|
||||
url: "/api/tbShopUnit",
|
||||
method: "get",
|
||||
url: '/api/tbShopUnit',
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,8 +43,8 @@ export function tbShopUnit(params) {
|
||||
export function tbShopCurrency(shopId) {
|
||||
return request({
|
||||
url: `/api/tbShopCurrency/${shopId}`,
|
||||
method: "get"
|
||||
});
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,9 +54,9 @@ export function tbShopCurrency(shopId) {
|
||||
export function tbShopCurrencyPut(data) {
|
||||
return request({
|
||||
url: `/api/tbShopCurrency`,
|
||||
method: "put",
|
||||
method: 'put',
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,9 +66,9 @@ export function tbShopCurrencyPut(data) {
|
||||
export function tbShopUnitPost(data) {
|
||||
return request({
|
||||
url: `/api/tbShopUnit`,
|
||||
method: "post",
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,9 +78,9 @@ export function tbShopUnitPost(data) {
|
||||
export function tbShopUnitPut(data) {
|
||||
return request({
|
||||
url: `/api/tbShopUnit`,
|
||||
method: "put",
|
||||
method: 'put',
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,9 +90,9 @@ export function tbShopUnitPut(data) {
|
||||
export function tbShopUnitDelete(data) {
|
||||
return request({
|
||||
url: `/api/tbShopUnit`,
|
||||
method: "delete",
|
||||
method: 'delete',
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -102,9 +102,9 @@ export function tbShopUnitDelete(data) {
|
||||
export function tbShopCurrencyGet(params) {
|
||||
return request({
|
||||
url: `/api/tbShopUnit`,
|
||||
method: "get",
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,21 +114,21 @@ export function tbShopCurrencyGet(params) {
|
||||
export function tbShopCategoryGet(params) {
|
||||
return request({
|
||||
url: `/api/tbShopCategory`,
|
||||
method: "get",
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增、编辑分类/新增、编辑子分类
|
||||
* @returns
|
||||
*/
|
||||
export function tbShopCategoryPost(data, method = "post") {
|
||||
export function tbShopCategoryPost(data, method = 'post') {
|
||||
return request({
|
||||
url: `/api/tbShopCategory`,
|
||||
method: method,
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -138,9 +138,9 @@ export function tbShopCategoryPost(data, method = "post") {
|
||||
export function tbShopCategoryDelete(data) {
|
||||
return request({
|
||||
url: `/api/tbShopCategory`,
|
||||
method: "delete",
|
||||
method: 'delete',
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,9 +150,9 @@ export function tbShopCategoryDelete(data) {
|
||||
export function tbProductSpecPost(data) {
|
||||
return request({
|
||||
url: `/api/tbProductSpec`,
|
||||
method: "post",
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -162,9 +162,9 @@ export function tbProductSpecPost(data) {
|
||||
export function tbProductSpecGet(params) {
|
||||
return request({
|
||||
url: `/api/tbProductSpec`,
|
||||
method: "get",
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -174,9 +174,9 @@ export function tbProductSpecGet(params) {
|
||||
export function tbProductSpecPut(data) {
|
||||
return request({
|
||||
url: `/api/tbProductSpec`,
|
||||
method: "put",
|
||||
method: 'put',
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -186,9 +186,9 @@ export function tbProductSpecPut(data) {
|
||||
export function tbProductSpecDelete(data) {
|
||||
return request({
|
||||
url: `/api/tbProductSpec`,
|
||||
method: "DELETE",
|
||||
method: 'DELETE',
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -198,9 +198,9 @@ export function tbProductSpecDelete(data) {
|
||||
export function tbProductGroupPost(data) {
|
||||
return request({
|
||||
url: `/api/tbProductGroup`,
|
||||
method: "post",
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -210,9 +210,9 @@ export function tbProductGroupPost(data) {
|
||||
export function tbProductGroupPut(data) {
|
||||
return request({
|
||||
url: `/api/tbProductGroup`,
|
||||
method: "PUT",
|
||||
method: 'PUT',
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -222,9 +222,9 @@ export function tbProductGroupPut(data) {
|
||||
export function tbProductGroupGet(params) {
|
||||
return request({
|
||||
url: `/api/tbProductGroup`,
|
||||
method: "get",
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -234,8 +234,8 @@ export function tbProductGroupGet(params) {
|
||||
export function productListGet(productGroup) {
|
||||
return request({
|
||||
url: `/api/tbProductGroup/${productGroup}`,
|
||||
method: "get"
|
||||
});
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -245,9 +245,9 @@ export function productListGet(productGroup) {
|
||||
export function tbProductGroupDelete(data) {
|
||||
return request({
|
||||
url: `/api/tbProductGroup`,
|
||||
method: "DELETE",
|
||||
method: 'DELETE',
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -257,9 +257,9 @@ export function tbProductGroupDelete(data) {
|
||||
export function tbProductPost(data) {
|
||||
return request({
|
||||
url: `/api/tbProduct`,
|
||||
method: "post",
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -269,9 +269,9 @@ export function tbProductPost(data) {
|
||||
export function tbProductPut(data) {
|
||||
return request({
|
||||
url: `/api/tbProduct`,
|
||||
method: "put",
|
||||
method: 'put',
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -282,8 +282,8 @@ export function tbProductPut(data) {
|
||||
export function tbProductGetDetail(product) {
|
||||
return request({
|
||||
url: `/api/tbProduct/${product}`,
|
||||
method: "get"
|
||||
});
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -293,9 +293,9 @@ export function tbProductGetDetail(product) {
|
||||
export function tbShopInfo(params) {
|
||||
return request({
|
||||
url: `/api/tbShopInfo`,
|
||||
method: "get",
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -305,9 +305,9 @@ export function tbShopInfo(params) {
|
||||
export function tbMerchantRegisterPost(data) {
|
||||
return request({
|
||||
url: `/api/tbMerchantRegister`,
|
||||
method: "post",
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -317,21 +317,21 @@ export function tbMerchantRegisterPost(data) {
|
||||
export function tbMerchantRegisterList(data) {
|
||||
return request({
|
||||
url: `/api/tbMerchantRegister/list`,
|
||||
method: "post",
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加/编辑店铺
|
||||
* @returns
|
||||
*/
|
||||
export function tbShopInfoPost(data, method = "post") {
|
||||
export function tbShopInfoPost(data, method = 'post') {
|
||||
return request({
|
||||
url: `/api/tbShopInfo`,
|
||||
method: method,
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -341,8 +341,8 @@ export function tbShopInfoPost(data, method = "post") {
|
||||
export function tbMerchantThirdApply(shopId) {
|
||||
return request({
|
||||
url: `/api/tbMerchantThirdApply/${shopId}`,
|
||||
method: "get"
|
||||
});
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -352,9 +352,9 @@ export function tbMerchantThirdApply(shopId) {
|
||||
export function tbMerchantThirdApplyPut(data) {
|
||||
return request({
|
||||
url: `/api/tbMerchantThirdApply`,
|
||||
method: "put",
|
||||
method: 'put',
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -364,21 +364,21 @@ export function tbMerchantThirdApplyPut(data) {
|
||||
export function tbProductIsHot(params) {
|
||||
return request({
|
||||
url: `/api/tbProduct/isHot`,
|
||||
method: "get",
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加/编辑优惠券
|
||||
* @returns
|
||||
*/
|
||||
export function tbMerchantCoupon(data, method = "post") {
|
||||
export function tbMerchantCoupon(data, method = 'post') {
|
||||
return request({
|
||||
url: `/api/tbMerchantCoupon`,
|
||||
method: method,
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -388,222 +388,10 @@ export function tbMerchantCoupon(data, method = "post") {
|
||||
export function tbMerchantCouponGet(params) {
|
||||
return request({
|
||||
url: `/api/tbMerchantCoupon`,
|
||||
method: "get",
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置热销商品
|
||||
* @returns
|
||||
*/
|
||||
export function geocode(params) {
|
||||
return request({
|
||||
url: `/api/geocode`,
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增、修改活动
|
||||
* @returns
|
||||
*/
|
||||
export function modityActivate(data) {
|
||||
return request({
|
||||
url: `/shop/storage/modityActivate`,
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动列表
|
||||
* @returns
|
||||
*/
|
||||
export function findActivate(params) {
|
||||
return request({
|
||||
url: `/shop/storage/findActivate`,
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
}
|
||||
// 获取店铺会员二维码
|
||||
export function getwxacode(data) {
|
||||
return request({
|
||||
url: `/shop/storage/getwxacode`,
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 商家用户列表
|
||||
* @returns
|
||||
*/
|
||||
export function queryAllShopUser(params) {
|
||||
return request({
|
||||
url: `/api/tbShopUser/queryAllShopUser`,
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...params
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 查询商家用户概述信息
|
||||
* @returns
|
||||
*/
|
||||
export function queryAllShopInfo(params) {
|
||||
return request({
|
||||
url: `/api/tbShopUser/summary`,
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...params
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品排序
|
||||
* @returns
|
||||
*/
|
||||
export function upProSort(data) {
|
||||
return request({
|
||||
url: `/api/tbProduct/upProSort`,
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改分组排序
|
||||
* @returns
|
||||
*/
|
||||
export function upGroupSort(data) {
|
||||
return request({
|
||||
url: `/api/tbProductGroup/upGroupSort`,
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改分类排序
|
||||
* @returns
|
||||
*/
|
||||
export function upCategorySort(data) {
|
||||
return request({
|
||||
url: `/api/tbShopCategory/upCategorySort`,
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询店铺充值记录
|
||||
* @returns
|
||||
*/
|
||||
export function tbShopUserRecharge(params) {
|
||||
return request({
|
||||
url: `/api/tbShopUser/recharge`,
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...params
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出充值记录
|
||||
* @returns
|
||||
*/
|
||||
export function downloadTableRecharge(data) {
|
||||
return request({
|
||||
url: `/api/tbShopUser/recharge/download`,
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
},
|
||||
responseType: "blob"
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工列表
|
||||
* @returns
|
||||
*/
|
||||
export function tbPlussShopStaffGet(params) {
|
||||
return request({
|
||||
url: `/api/tbPlussShopStaff`,
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...params
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色列表
|
||||
* @returns
|
||||
*/
|
||||
export function rolesGet() {
|
||||
return request({
|
||||
url: `/api/roles`,
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加员工
|
||||
* @returns
|
||||
*/
|
||||
export function tbPlussShopStaff(data) {
|
||||
return request({
|
||||
url: `/api/tbPlussShopStaff`,
|
||||
method: data.id ? "put" : "post",
|
||||
data: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id获取员工信息
|
||||
* @returns
|
||||
*/
|
||||
export function tbPlussShopStaffDetail(id) {
|
||||
return request({
|
||||
url: `/api/tbPlussShopStaff/${id}`,
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改员工状态
|
||||
* @returns
|
||||
*/
|
||||
export function updateStatus(data) {
|
||||
return request({
|
||||
url: `/api/tbPlussShopStaff/updateStatus`,
|
||||
method: "put",
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工删除
|
||||
* @returns
|
||||
*/
|
||||
export function shopStaffDelete(data) {
|
||||
return request({
|
||||
url: `/api/tbPlussShopStaff`,
|
||||
method: "delete",
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 桌台管理
|
||||
import request from "@/utils/request";
|
||||
import request from '@/utils/request'
|
||||
|
||||
/**
|
||||
* 台桌列表
|
||||
@@ -8,9 +8,9 @@ import request from "@/utils/request";
|
||||
export function tbShopTableGet(params) {
|
||||
return request({
|
||||
url: `/api/tbShopTable`,
|
||||
method: "get",
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -20,9 +20,9 @@ export function tbShopTableGet(params) {
|
||||
export function tbShopAreaGet(params) {
|
||||
return request({
|
||||
url: `/api/tbShopArea`,
|
||||
method: "get",
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -34,7 +34,7 @@ export function tbShopArea(data, method) {
|
||||
url: `/api/tbShopArea`,
|
||||
method: method,
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,9 +44,9 @@ export function tbShopArea(data, method) {
|
||||
export function tbShopAreaDelete(data) {
|
||||
return request({
|
||||
url: `/api/tbShopArea`,
|
||||
method: "DELETE",
|
||||
method: 'DELETE',
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,7 +58,7 @@ export function tbShopTable(data, method) {
|
||||
url: `/api/tbShopTable`,
|
||||
method: method,
|
||||
data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,53 +68,9 @@ export function tbShopTable(data, method) {
|
||||
export function tbShopTableDelete(data) {
|
||||
return request({
|
||||
url: `/api/tbShopTable`,
|
||||
method: "DELETE",
|
||||
method: 'DELETE',
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载桌码
|
||||
* @returns
|
||||
*/
|
||||
export function downloadTableCode(data) {
|
||||
return request({
|
||||
url: `/api/deviceStock/batchDownload`,
|
||||
method: "post",
|
||||
data,
|
||||
responseType: "blob"
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 桌台统计
|
||||
* @returns
|
||||
*/
|
||||
export function summaryTable(params) {
|
||||
return request({
|
||||
url: `/api/summary/table`,
|
||||
method: "get",
|
||||
params:{
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...params
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 桌台统计导出文档
|
||||
* @returns
|
||||
*/
|
||||
export function summaryTableDownload(data) {
|
||||
return request({
|
||||
url: `/api/summary/table/download`,
|
||||
method: "POST",
|
||||
data:{
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
},
|
||||
responseType: 'blob'
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-upload :action="uploadUrl" :before-upload="handleBeforeUpload" :on-success="handleUploadSuccess"
|
||||
:on-error="handleUploadError" name="file" :show-file-list="false" :headers="headers" style="display: none"
|
||||
ref="upload" v-if="this.type == 'url'">
|
||||
<el-upload
|
||||
:action="uploadUrl"
|
||||
:before-upload="handleBeforeUpload"
|
||||
:on-success="handleUploadSuccess"
|
||||
:on-error="handleUploadError"
|
||||
name="file"
|
||||
:show-file-list="false"
|
||||
:headers="headers"
|
||||
style="display: none"
|
||||
ref="upload"
|
||||
v-if="this.type == 'url'"
|
||||
>
|
||||
</el-upload>
|
||||
<div class="editor" ref="editor" :style="styles"></div>
|
||||
</div>
|
||||
@@ -116,11 +125,6 @@ export default {
|
||||
init() {
|
||||
const editor = this.$refs.editor;
|
||||
this.Quill = new Quill(editor, this.options);
|
||||
this.Quill.enable(false)
|
||||
this.$nextTick(() => {
|
||||
this.Quill.enable(true)
|
||||
this.Quill.blur()
|
||||
})
|
||||
// 如果设置了上传地址则自定义图片上传事件
|
||||
if (this.type == 'url') {
|
||||
let toolbar = this.Quill.getModule("toolbar");
|
||||
@@ -151,7 +155,6 @@ export default {
|
||||
this.Quill.on("editor-change", (eventName, ...args) => {
|
||||
this.$emit("on-editor-change", eventName, ...args);
|
||||
});
|
||||
|
||||
},
|
||||
// 上传前校检格式和大小
|
||||
handleBeforeUpload(file) {
|
||||
@@ -169,7 +172,7 @@ export default {
|
||||
// 获取富文本组件实例
|
||||
let quill = this.Quill;
|
||||
// 如果上传成功
|
||||
if (res.id > 0) {
|
||||
if (res.id >0) {
|
||||
// 获取光标所在位置
|
||||
let length = quill.getSelection().index;
|
||||
// 插入图片 res.url为服务器返回的图片地址
|
||||
@@ -188,20 +191,16 @@ export default {
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.editor,
|
||||
.ql-toolbar {
|
||||
.editor, .ql-toolbar {
|
||||
white-space: pre-wrap !important;
|
||||
line-height: normal !important;
|
||||
}
|
||||
|
||||
.quill-img {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ql-snow .ql-tooltip[data-mode="link"]::before {
|
||||
content: "请输入链接地址:";
|
||||
}
|
||||
|
||||
.ql-snow .ql-tooltip.ql-editing a.ql-action::after {
|
||||
border-right: 0px;
|
||||
content: "保存";
|
||||
@@ -216,17 +215,14 @@ export default {
|
||||
.ql-snow .ql-picker.ql-size .ql-picker-item::before {
|
||||
content: "14px";
|
||||
}
|
||||
|
||||
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="small"]::before,
|
||||
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="small"]::before {
|
||||
content: "10px";
|
||||
}
|
||||
|
||||
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="large"]::before,
|
||||
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="large"]::before {
|
||||
content: "18px";
|
||||
}
|
||||
|
||||
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="huge"]::before,
|
||||
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="huge"]::before {
|
||||
content: "32px";
|
||||
@@ -236,32 +232,26 @@ export default {
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-item::before {
|
||||
content: "文本";
|
||||
}
|
||||
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="1"]::before,
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="1"]::before {
|
||||
content: "标题1";
|
||||
}
|
||||
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="2"]::before,
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]::before {
|
||||
content: "标题2";
|
||||
}
|
||||
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="3"]::before,
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]::before {
|
||||
content: "标题3";
|
||||
}
|
||||
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="4"]::before,
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="4"]::before {
|
||||
content: "标题4";
|
||||
}
|
||||
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="5"]::before,
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="5"]::before {
|
||||
content: "标题5";
|
||||
}
|
||||
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="6"]::before,
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="6"]::before {
|
||||
content: "标题6";
|
||||
@@ -271,12 +261,10 @@ export default {
|
||||
.ql-snow .ql-picker.ql-font .ql-picker-item::before {
|
||||
content: "标准字体";
|
||||
}
|
||||
|
||||
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="serif"]::before,
|
||||
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="serif"]::before {
|
||||
content: "衬线字体";
|
||||
}
|
||||
|
||||
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="monospace"]::before,
|
||||
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="monospace"]::before {
|
||||
content: "等宽字体";
|
||||
|
||||
@@ -1,138 +0,0 @@
|
||||
<template>
|
||||
<el-dialog title="选择团购券分类" :visible.sync="dialogVisible" @open="resetHandle()">
|
||||
<el-form :model="searhForm" inline>
|
||||
<el-form-item>
|
||||
<el-input v-model="searhForm.name" placeholder="分类名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="head-container">
|
||||
<el-table ref="table" :data="tableData.list" v-loading="tableData.loading">
|
||||
<el-table-column type="selection" width="55" align="center"></el-table-column>
|
||||
<el-table-column label="名称" prop="name"></el-table-column>
|
||||
<el-table-column label="状态" prop="status">
|
||||
<template v-slot="scope">
|
||||
<el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0"
|
||||
disabled></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
||||
@current-change="paginationChange" @size-change="sizeChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="confirmHandle">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { tbCouponCategoryGet } from "@/api/setting";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
searhForm: {
|
||||
name: ''
|
||||
},
|
||||
tableData: {
|
||||
page: 0,
|
||||
size: 10,
|
||||
total: 0,
|
||||
loading: false,
|
||||
list: []
|
||||
},
|
||||
goods: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 确定选商品
|
||||
confirmHandle(row) {
|
||||
let res = this.$refs.table.selection
|
||||
this.$emit('success', res)
|
||||
this.close()
|
||||
},
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.searhForm.name = ''
|
||||
this.tableData.page = 0
|
||||
this.tableData.size = 10
|
||||
this.tableData.list = []
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页大小改变
|
||||
sizeChange(e) {
|
||||
this.tableData.size = e
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1
|
||||
this.getTableData()
|
||||
},
|
||||
// 商品列表
|
||||
async getTableData() {
|
||||
this.tableData.loading = true
|
||||
try {
|
||||
const res = await tbCouponCategoryGet({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
name: this.searhForm.name,
|
||||
sort: 'id',
|
||||
})
|
||||
this.tableData.list = res.content
|
||||
this.tableData.total = res.totalElements
|
||||
|
||||
if (this.goods.length) {
|
||||
this.$nextTick(() => {
|
||||
this.selection()
|
||||
})
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.tableData.loading = false
|
||||
}, 500);
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
show(goods) {
|
||||
this.dialogVisible = true
|
||||
if (goods && goods.length) {
|
||||
this.goods = [...goods]
|
||||
} else {
|
||||
this.goods = []
|
||||
}
|
||||
this.resetHandle()
|
||||
this.getTableData()
|
||||
},
|
||||
close() {
|
||||
this.dialogVisible = false
|
||||
},
|
||||
selection() {
|
||||
this.goods.forEach(row => {
|
||||
this.tableData.list.forEach((item, index) => {
|
||||
if (row.id == item.id) {
|
||||
this.$refs.table.toggleRowSelection(this.tableData.list[index]);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.shop_info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
span {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -30,19 +30,6 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.typeEnum }}
|
||||
</template>
|
||||
</el-table-column> <el-table-column label="是否售罄">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.isPauseSale == 1?'是':'否' }}
|
||||
</template>
|
||||
</el-table-column> <el-table-column label="是否分销">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.isDistribute == 1?'是':'否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="售价">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.lowPrice }}
|
||||
@@ -53,7 +40,7 @@
|
||||
{{ scope.row.realSalesNumber }}/{{ scope.row.stockNumber }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="分类名称" prop="categoryName"></el-table-column>
|
||||
<el-table-column label="分类" prop="categoryName"></el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
||||
@@ -125,6 +112,7 @@ export default {
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
sort: 'id',
|
||||
})
|
||||
this.tableData.loading = false
|
||||
this.tableData.list = res.content
|
||||
this.tableData.total = res.totalElements
|
||||
|
||||
@@ -133,9 +121,6 @@ export default {
|
||||
this.selection()
|
||||
})
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.tableData.loading = false
|
||||
}, 500);
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ export default {
|
||||
dialogImageUrl: '',
|
||||
dialogVisible: false,
|
||||
fileList: [],
|
||||
// files: [],
|
||||
files: [],
|
||||
headers: {
|
||||
'Authorization': getToken()
|
||||
}
|
||||
@@ -45,13 +45,7 @@ export default {
|
||||
methods: {
|
||||
handleSuccess(response, file, fileList) {
|
||||
// console.log('上传成功', response)
|
||||
setTimeout(() => {
|
||||
this.fileList.push({
|
||||
url: response.data[0],
|
||||
id: response.data.id
|
||||
})
|
||||
}, 100);
|
||||
// this.files = response.data
|
||||
this.files = response.data
|
||||
this.$emit('success', response.data)
|
||||
},
|
||||
// 监听上传失败
|
||||
@@ -75,9 +69,6 @@ export default {
|
||||
},
|
||||
handleRemove(file, fileList) {
|
||||
let arr = fileList.map(item => item.url)
|
||||
// 删除数据
|
||||
let index = this.fileList.findIndex(ele => ele.url == file.url)
|
||||
this.fileList.splice(index, 1);
|
||||
this.$emit('remove', arr)
|
||||
},
|
||||
clearFiles() {
|
||||
@@ -86,10 +77,3 @@ export default {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.el-upload-list__item {
|
||||
|
||||
transition: none;
|
||||
|
||||
}
|
||||
</style>
|
||||
@@ -33,11 +33,6 @@
|
||||
个人中心
|
||||
</el-dropdown-item>
|
||||
</router-link>
|
||||
<span @click="dialogVisible = true">
|
||||
<el-dropdown-item>
|
||||
修改密码
|
||||
</el-dropdown-item>
|
||||
</span>
|
||||
<span style="display:block;" @click="open">
|
||||
<el-dropdown-item divided>
|
||||
退出登录
|
||||
@@ -46,32 +41,6 @@
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
<el-dialog title="修改密码" modal-append-to-body append-to-body :visible.sync="dialogVisible" width="400px">
|
||||
<el-form ref="form" :model="form" :rules="rules">
|
||||
<el-form-item label="旧密码" prop="oldPass">
|
||||
<el-input :type="ip1Type" v-model="form.oldPass" placeholder="请输入旧密码">
|
||||
<i slot="suffix" :class="`el-input__icon ${ip1Type == 'text' ? 'el-icon-view' : 'el-icon-remove-outline'}`"
|
||||
@click.stop="changeInputType('ip1Type')"></i>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="新密码" prop="newPass">
|
||||
<el-input :type="ip2Type" v-model="form.newPass" placeholder="请输入新密码">
|
||||
<i slot="suffix" :class="`el-input__icon ${ip2Type == 'text' ? 'el-icon-view' : 'el-icon-remove-outline'}`"
|
||||
@click.stop="changeInputType('ip2Type')"></i>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="确认新密码" prop="rnewPass">
|
||||
<el-input :type="ip3Type" v-model="form.rnewPass" placeholder="请再次输入新密码">
|
||||
<i slot="suffix" :class="`el-input__icon ${ip3Type == 'text' ? 'el-icon-view' : 'el-icon-remove-outline'}`"
|
||||
@click.stop="changeInputType('ip3Type')"></i>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" :loading="formLoading" @click="submitHandle">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -84,8 +53,6 @@ import Screenfull from '@/components/Screenfull'
|
||||
import SizeSelect from '@/components/SizeSelect'
|
||||
import Search from '@/components/HeaderSearch'
|
||||
import Avatar from '@/assets/images/avatar.png'
|
||||
import { updatePass } from '@/api/login.js'
|
||||
import { encrypt } from '@/utils/rsaEncrypt'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -97,61 +64,11 @@ export default {
|
||||
Doc
|
||||
},
|
||||
data() {
|
||||
const validateNewPass = (rule, value, callback) => {
|
||||
if (!this.form.newPass) {
|
||||
callback(new Error(' '))
|
||||
} else if (this.form.newPass === this.form.oldPass) {
|
||||
callback(new Error('请输入与旧密码不同的新密码'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
const validateRnewPass = (rule, value, callback) => {
|
||||
if (!this.form.rnewPass) {
|
||||
callback(new Error(' '))
|
||||
} else if (this.form.rnewPass !== this.form.newPass) {
|
||||
callback(new Error('两次密码输入不一致'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
return {
|
||||
Avatar: Avatar,
|
||||
dialogVisible: false,
|
||||
logo: localStorage.getItem('logo'),
|
||||
shopName: localStorage.getItem('shopName'),
|
||||
ip1Type: 'password',
|
||||
ip2Type: 'password',
|
||||
ip3Type: 'password',
|
||||
formLoading: false,
|
||||
form: {
|
||||
oldPass: '',
|
||||
newPass: '',
|
||||
rnewPass: ''
|
||||
},
|
||||
rules: {
|
||||
oldPass: [
|
||||
{
|
||||
required: true,
|
||||
message: ' ',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
newPass: [
|
||||
{
|
||||
required: true,
|
||||
validator: validateNewPass,
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
rnewPass: [
|
||||
{
|
||||
required: true,
|
||||
validator: validateRnewPass,
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
}
|
||||
shopName: localStorage.getItem('shopName')
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -174,36 +91,6 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 修改密码框类型
|
||||
changeInputType(key) {
|
||||
if (this[key] == 'text') {
|
||||
this[key] = 'password'
|
||||
} else {
|
||||
this[key] = 'text'
|
||||
}
|
||||
},
|
||||
// 提交修改密码
|
||||
submitHandle() {
|
||||
this.$refs.form.validate(async vaild => {
|
||||
if (vaild) {
|
||||
try {
|
||||
this.formLoading = true
|
||||
const res = await updatePass({
|
||||
loginType: localStorage.getItem('loginType'),
|
||||
oldPass: encrypt(this.form.oldPass),
|
||||
newPass: this.form.newPass
|
||||
})
|
||||
this.$notify.success('修改成功,请重新登陆')
|
||||
setTimeout(() => {
|
||||
this.logout()
|
||||
}, 1000)
|
||||
} catch (error) {
|
||||
this.formLoading = false
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
toggleSideBar() {
|
||||
this.$store.dispatch('app/toggleSideBar')
|
||||
},
|
||||
|
||||
83
src/main.js
83
src/main.js
@@ -1,77 +1,60 @@
|
||||
import Vue from "vue";
|
||||
import Vue from 'vue'
|
||||
|
||||
import Cookies from "js-cookie";
|
||||
import Cookies from 'js-cookie'
|
||||
|
||||
import "normalize.css/normalize.css";
|
||||
import 'normalize.css/normalize.css'
|
||||
|
||||
import Element from "element-ui";
|
||||
|
||||
// 图片选择器
|
||||
// import VueSelectImage from 'vue-select-image'
|
||||
// import "vue-select-image/dist/vue-select-image.css";
|
||||
// Vue.use(VueSelectImage)
|
||||
import Element from 'element-ui'
|
||||
|
||||
// 数据字典
|
||||
import dict from "./components/Dict";
|
||||
import Editor from "@/components/Editor";
|
||||
import dict from './components/Dict'
|
||||
import Editor from "@/components/Editor"
|
||||
|
||||
// 权限指令
|
||||
import checkPer from "@/utils/permission";
|
||||
import permission from "./components/Permission";
|
||||
import "./assets/styles/element-variables.scss";
|
||||
import checkPer from '@/utils/permission'
|
||||
import permission from './components/Permission'
|
||||
import './assets/styles/element-variables.scss'
|
||||
|
||||
// global css
|
||||
import "./assets/styles/index.scss";
|
||||
import './assets/styles/index.scss'
|
||||
|
||||
import App from "./App";
|
||||
import store from "./store";
|
||||
import router from "./router/routers";
|
||||
import App from './App'
|
||||
import store from './store'
|
||||
import router from './router/routers'
|
||||
|
||||
import "./assets/icons"; // icon
|
||||
import "./router/index"; // permission control
|
||||
import './assets/icons' // icon
|
||||
import './router/index' // permission control
|
||||
|
||||
// 全局引入
|
||||
import EleUploadImage from "vue-ele-upload-image";
|
||||
import VueAMap from "vue-amap";
|
||||
import EleUploadImage from 'vue-ele-upload-image'
|
||||
import VueAMap from 'vue-amap';
|
||||
|
||||
import VueClipboard from "vue-clipboard2";
|
||||
import VueClipboard from 'vue-clipboard2'
|
||||
|
||||
import { isPcBowser } from "@/utils/index";
|
||||
|
||||
Vue.component(EleUploadImage.name, EleUploadImage);
|
||||
Vue.component("Editor", Editor);
|
||||
Vue.component(EleUploadImage.name, EleUploadImage)
|
||||
Vue.component('Editor', Editor)
|
||||
|
||||
Vue.use(checkPer);
|
||||
Vue.use(permission);
|
||||
Vue.use(dict);
|
||||
Vue.use(checkPer)
|
||||
Vue.use(permission)
|
||||
Vue.use(dict)
|
||||
Vue.use(Element, {
|
||||
size: Cookies.get("size") || "small" // set element-ui default size
|
||||
});
|
||||
Vue.use(VueAMap);
|
||||
Vue.use(VueClipboard);
|
||||
|
||||
Vue.prototype.isPcBowser = isPcBowser();
|
||||
size: Cookies.get('size') || 'small' // set element-ui default size
|
||||
})
|
||||
Vue.use(VueAMap)
|
||||
Vue.use(VueClipboard)
|
||||
|
||||
VueAMap.initAMapApiLoader({
|
||||
key: "6033c97e67bf2e9ceac306e1a3fa35f8",
|
||||
key: '6033c97e67bf2e9ceac306e1a3fa35f8',
|
||||
// securityJsCode: '0547b69252ef0ed14e11f5c4ac152f07',
|
||||
plugin: [
|
||||
"AMap.Autocomplete",
|
||||
"AMap.PlaceSearch",
|
||||
"AMap.Scale",
|
||||
"AMap.OverView",
|
||||
"AMap.ToolBar",
|
||||
"AMap.MapType",
|
||||
"AMap.PolyEditor",
|
||||
"AMap.CircleEditor"
|
||||
]
|
||||
});
|
||||
plugin: ['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor']
|
||||
})
|
||||
|
||||
Vue.config.productionTip = false;
|
||||
Vue.config.productionTip = false
|
||||
|
||||
new Vue({
|
||||
el: "#app",
|
||||
el: '#app',
|
||||
router,
|
||||
store,
|
||||
render: h => h(App)
|
||||
});
|
||||
})
|
||||
|
||||
@@ -52,18 +52,6 @@ export const constantRouterMap = [
|
||||
component: (resolve) => require(['@/views/home/data_forms'], resolve),
|
||||
name: 'data_forms',
|
||||
meta: { title: '数据报表' }
|
||||
},
|
||||
{
|
||||
path: 'data_tables',
|
||||
component: (resolve) => require(['@/views/home/data_tables'], resolve),
|
||||
name: 'data_tables',
|
||||
meta: { title: '桌台统计' }
|
||||
},
|
||||
{
|
||||
path: 'data_record',
|
||||
component: (resolve) => require(['@/views/home/data_record'], resolve),
|
||||
name: 'data_record',
|
||||
meta: { title: '交班记录' }
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { login, getInfo, logout } from "@/api/login";
|
||||
import { getToken, setToken, removeToken } from "@/utils/auth";
|
||||
import { login, getInfo, logout } from '@/api/login'
|
||||
import { getToken, setToken, removeToken } from '@/utils/auth'
|
||||
|
||||
const user = {
|
||||
state: {
|
||||
@@ -13,98 +13,91 @@ const user = {
|
||||
mutations: {
|
||||
// 是否为手动退出登录
|
||||
SD_LOGOUT: (state, f) => {
|
||||
state.sdLogout = f;
|
||||
state.sdLogout = f
|
||||
},
|
||||
SET_TOKEN: (state, token) => {
|
||||
state.token = token;
|
||||
state.token = token
|
||||
},
|
||||
SET_USER: (state, user) => {
|
||||
state.user = user;
|
||||
state.user = user
|
||||
},
|
||||
SET_ROLES: (state, roles) => {
|
||||
state.roles = roles;
|
||||
state.roles = roles
|
||||
},
|
||||
SET_LOAD_MENUS: (state, loadMenus) => {
|
||||
state.loadMenus = loadMenus;
|
||||
state.loadMenus = loadMenus
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
// 登录
|
||||
Login({ commit }, userInfo) {
|
||||
const rememberMe = userInfo.rememberMe;
|
||||
const rememberMe = userInfo.rememberMe
|
||||
return new Promise((resolve, reject) => {
|
||||
login(userInfo)
|
||||
.then(res => {
|
||||
login(userInfo.username, userInfo.password, userInfo.code, userInfo.uuid).then(res => {
|
||||
// console.log('登录成功后返回===', res)
|
||||
localStorage.setItem("logoutHandle", false);
|
||||
localStorage.setItem("shopId", res.shopId);
|
||||
localStorage.setItem("shopName", res.shopName);
|
||||
localStorage.setItem("logo", res.logo);
|
||||
localStorage.setItem("loginType", res.loginType);
|
||||
setToken(res.token, rememberMe);
|
||||
commit("SET_TOKEN", res.token);
|
||||
setUserInfo(res.user, commit);
|
||||
localStorage.setItem('logoutHandle', false)
|
||||
localStorage.setItem('shopId', res.shopId)
|
||||
localStorage.setItem('shopName', res.shopName)
|
||||
localStorage.setItem('logo', res.logo)
|
||||
setToken(res.token, rememberMe)
|
||||
commit('SET_TOKEN', res.token)
|
||||
setUserInfo(res.user, commit)
|
||||
// 第一次加载菜单时用到, 具体见 src 目录下的 permission.js
|
||||
commit("SET_LOAD_MENUS", true);
|
||||
resolve();
|
||||
commit('SET_LOAD_MENUS', true)
|
||||
resolve()
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
.catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
// 获取用户信息
|
||||
GetInfo({ commit }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
getInfo()
|
||||
.then(res => {
|
||||
setUserInfo(res, commit);
|
||||
resolve(res);
|
||||
getInfo().then(res => {
|
||||
setUserInfo(res, commit)
|
||||
resolve(res)
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
.catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
// 登出
|
||||
LogOut({ commit }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
logout()
|
||||
.then(res => {
|
||||
logOut(commit);
|
||||
resolve();
|
||||
logout().then(res => {
|
||||
logOut(commit)
|
||||
resolve()
|
||||
}).catch(error => {
|
||||
logOut(commit)
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
.catch(error => {
|
||||
logOut(commit);
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
updateLoadMenus({ commit }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
commit("SET_LOAD_MENUS", false);
|
||||
});
|
||||
commit('SET_LOAD_MENUS', false)
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const logOut = commit => {
|
||||
commit("SET_TOKEN", "");
|
||||
commit("SET_ROLES", []);
|
||||
removeToken();
|
||||
};
|
||||
export const logOut = (commit) => {
|
||||
commit('SET_TOKEN', '')
|
||||
commit('SET_ROLES', [])
|
||||
removeToken()
|
||||
}
|
||||
|
||||
export const setUserInfo = (res, commit) => {
|
||||
// 如果没有任何权限,则赋予一个默认的权限,避免请求死循环
|
||||
if (res.roles.length === 0) {
|
||||
commit("SET_ROLES", ["ROLE_SYSTEM_DEFAULT"]);
|
||||
commit('SET_ROLES', ['ROLE_SYSTEM_DEFAULT'])
|
||||
} else {
|
||||
commit("SET_ROLES", res.roles);
|
||||
commit('SET_ROLES', res.roles)
|
||||
}
|
||||
commit("SET_USER", res.user);
|
||||
};
|
||||
commit('SET_USER', res.user)
|
||||
}
|
||||
|
||||
export default user;
|
||||
export default user
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
/**
|
||||
* 格式化价格函数,将价格限定在指定的最小值和最大值范围内,并保留两位小数。
|
||||
*
|
||||
* @param {number} price - 需要格式化的价格。
|
||||
* @param {number} min - 价格的最小值。
|
||||
* @param {number} max - 价格的最大值,默认为100000000。
|
||||
* @param {Boolean} returnIsArea - 是否返回值符合范围区间,默认为false。
|
||||
* @returns {number} - 返回格式化后的价格,如果超出范围则返回最小值或最大值。
|
||||
*/
|
||||
export const formatPrice = (price,min=-Infinity, max = 100000000,returnIsArea=false ) => {
|
||||
if(price === undefined || price === null||price===''){
|
||||
return 0
|
||||
}
|
||||
// 将价格转换为浮点数并保留两位小数
|
||||
const newval = parseFloat((Math.floor(price * 100) / 100).toFixed(2))
|
||||
// 如果价格大于最大值,返回最大值
|
||||
if (newval > max) {
|
||||
return returnIsArea?{value:max,error:true}:max
|
||||
}
|
||||
// 如果价格小于最小值,返回最小值
|
||||
if (newval < min) {
|
||||
return returnIsArea?{value:min,error:true}:min
|
||||
}
|
||||
// 如果价格小于最小值,返回最小值
|
||||
if (newval < min) {
|
||||
return min
|
||||
}
|
||||
// 返回格式化后的价格
|
||||
return newval
|
||||
}
|
||||
@@ -10,22 +10,22 @@
|
||||
*/
|
||||
export function parseTime(time, cFormat) {
|
||||
if (arguments.length === 0) {
|
||||
return null;
|
||||
return null
|
||||
}
|
||||
const format = cFormat || "{y}-{m}-{d} {h}:{i}:{s}";
|
||||
let date;
|
||||
if (typeof time === "undefined" || time === null || time === "null") {
|
||||
return "";
|
||||
} else if (typeof time === "object") {
|
||||
date = time;
|
||||
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
|
||||
let date
|
||||
if (typeof time === 'undefined' || time === null || time === 'null') {
|
||||
return ''
|
||||
} else if (typeof time === 'object') {
|
||||
date = time
|
||||
} else {
|
||||
if (typeof time === "string" && /^[0-9]+$/.test(time)) {
|
||||
time = parseInt(time);
|
||||
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
|
||||
time = parseInt(time)
|
||||
}
|
||||
if (typeof time === "number" && time.toString().length === 10) {
|
||||
time = time * 1000;
|
||||
if ((typeof time === 'number') && (time.toString().length === 10)) {
|
||||
time = time * 1000
|
||||
}
|
||||
date = new Date(time);
|
||||
date = new Date(time)
|
||||
}
|
||||
const formatObj = {
|
||||
y: date.getFullYear(),
|
||||
@@ -35,19 +35,17 @@ export function parseTime(time, cFormat) {
|
||||
i: date.getMinutes(),
|
||||
s: date.getSeconds(),
|
||||
a: date.getDay()
|
||||
};
|
||||
}
|
||||
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
|
||||
let value = formatObj[key];
|
||||
let value = formatObj[key]
|
||||
// Note: getDay() returns 0 on Sunday
|
||||
if (key === "a") {
|
||||
return ["日", "一", "二", "三", "四", "五", "六"][value];
|
||||
}
|
||||
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
|
||||
if (result.length > 0 && value < 10) {
|
||||
value = "0" + value;
|
||||
value = '0' + value
|
||||
}
|
||||
return value || 0;
|
||||
});
|
||||
return time_str;
|
||||
return value || 0
|
||||
})
|
||||
return time_str
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,40 +54,40 @@ export function parseTime(time, cFormat) {
|
||||
* @returns {string}
|
||||
*/
|
||||
export function formatTime(time, option) {
|
||||
if (("" + time).length === 10) {
|
||||
time = parseInt(time) * 1000;
|
||||
if (('' + time).length === 10) {
|
||||
time = parseInt(time) * 1000
|
||||
} else {
|
||||
time = +time;
|
||||
time = +time
|
||||
}
|
||||
const d = new Date(time);
|
||||
const now = Date.now();
|
||||
const d = new Date(time)
|
||||
const now = Date.now()
|
||||
|
||||
const diff = (now - d) / 1000;
|
||||
const diff = (now - d) / 1000
|
||||
|
||||
if (diff < 30) {
|
||||
return "刚刚";
|
||||
return '刚刚'
|
||||
} else if (diff < 3600) {
|
||||
// less 1 hour
|
||||
return Math.ceil(diff / 60) + "分钟前";
|
||||
return Math.ceil(diff / 60) + '分钟前'
|
||||
} else if (diff < 3600 * 24) {
|
||||
return Math.ceil(diff / 3600) + "小时前";
|
||||
return Math.ceil(diff / 3600) + '小时前'
|
||||
} else if (diff < 3600 * 24 * 2) {
|
||||
return "1天前";
|
||||
return '1天前'
|
||||
}
|
||||
if (option) {
|
||||
return parseTime(time, option);
|
||||
return parseTime(time, option)
|
||||
} else {
|
||||
return (
|
||||
d.getMonth() +
|
||||
1 +
|
||||
"月" +
|
||||
'月' +
|
||||
d.getDate() +
|
||||
"日" +
|
||||
'日' +
|
||||
d.getHours() +
|
||||
"时" +
|
||||
'时' +
|
||||
d.getMinutes() +
|
||||
"分"
|
||||
);
|
||||
'分'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,18 +96,18 @@ export function formatTime(time, option) {
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function getQueryObject(url) {
|
||||
url = url == null ? window.location.href : url;
|
||||
const search = url.substring(url.lastIndexOf("?") + 1);
|
||||
const obj = {};
|
||||
const reg = /([^?&=]+)=([^?&=]*)/g;
|
||||
url = url == null ? window.location.href : url
|
||||
const search = url.substring(url.lastIndexOf('?') + 1)
|
||||
const obj = {}
|
||||
const reg = /([^?&=]+)=([^?&=]*)/g
|
||||
search.replace(reg, (rs, $1, $2) => {
|
||||
const name = decodeURIComponent($1);
|
||||
let val = decodeURIComponent($2);
|
||||
val = String(val);
|
||||
obj[name] = val;
|
||||
return rs;
|
||||
});
|
||||
return obj;
|
||||
const name = decodeURIComponent($1)
|
||||
let val = decodeURIComponent($2)
|
||||
val = String(val)
|
||||
obj[name] = val
|
||||
return rs
|
||||
})
|
||||
return obj
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,14 +116,14 @@ export function getQueryObject(url) {
|
||||
*/
|
||||
export function byteLength(str) {
|
||||
// returns the byte length of an utf8 string
|
||||
let s = str.length;
|
||||
let s = str.length
|
||||
for (var i = str.length - 1; i >= 0; i--) {
|
||||
const code = str.charCodeAt(i);
|
||||
if (code > 0x7f && code <= 0x7ff) s++;
|
||||
else if (code > 0x7ff && code <= 0xffff) s += 2;
|
||||
if (code >= 0xdc00 && code <= 0xdfff) i--;
|
||||
const code = str.charCodeAt(i)
|
||||
if (code > 0x7f && code <= 0x7ff) s++
|
||||
else if (code > 0x7ff && code <= 0xffff) s += 2
|
||||
if (code >= 0xDC00 && code <= 0xDFFF) i--
|
||||
}
|
||||
return s;
|
||||
return s
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,13 +131,13 @@ export function byteLength(str) {
|
||||
* @returns {Array}
|
||||
*/
|
||||
export function cleanArray(actual) {
|
||||
const newArray = [];
|
||||
const newArray = []
|
||||
for (let i = 0; i < actual.length; i++) {
|
||||
if (actual[i]) {
|
||||
newArray.push(actual[i]);
|
||||
newArray.push(actual[i])
|
||||
}
|
||||
}
|
||||
return newArray;
|
||||
return newArray
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -147,13 +145,13 @@ export function cleanArray(actual) {
|
||||
* @returns {Array}
|
||||
*/
|
||||
export function param(json) {
|
||||
if (!json) return "";
|
||||
if (!json) return ''
|
||||
return cleanArray(
|
||||
Object.keys(json).map(key => {
|
||||
if (json[key] === undefined) return "";
|
||||
return encodeURIComponent(key) + "=" + encodeURIComponent(json[key]);
|
||||
if (json[key] === undefined) return ''
|
||||
return encodeURIComponent(key) + '=' + encodeURIComponent(json[key])
|
||||
})
|
||||
).join("&");
|
||||
).join('&')
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,9 +159,9 @@ export function param(json) {
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function param2Obj(url) {
|
||||
const search = url.split("?")[1];
|
||||
const search = url.split('?')[1]
|
||||
if (!search) {
|
||||
return {};
|
||||
return {}
|
||||
}
|
||||
return JSON.parse(
|
||||
'{"' +
|
||||
@@ -171,9 +169,9 @@ export function param2Obj(url) {
|
||||
.replace(/"/g, '\\"')
|
||||
.replace(/&/g, '","')
|
||||
.replace(/=/g, '":"')
|
||||
.replace(/\+/g, " ") +
|
||||
.replace(/\+/g, ' ') +
|
||||
'"}'
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -181,9 +179,9 @@ export function param2Obj(url) {
|
||||
* @returns {string}
|
||||
*/
|
||||
export function html2Text(val) {
|
||||
const div = document.createElement("div");
|
||||
div.innerHTML = val;
|
||||
return div.textContent || div.innerText;
|
||||
const div = document.createElement('div')
|
||||
div.innerHTML = val
|
||||
return div.textContent || div.innerText
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -193,21 +191,21 @@ export function html2Text(val) {
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function objectMerge(target, source) {
|
||||
if (typeof target !== "object") {
|
||||
target = {};
|
||||
if (typeof target !== 'object') {
|
||||
target = {}
|
||||
}
|
||||
if (Array.isArray(source)) {
|
||||
return source.slice();
|
||||
return source.slice()
|
||||
}
|
||||
Object.keys(source).forEach(property => {
|
||||
const sourceProperty = source[property];
|
||||
if (typeof sourceProperty === "object") {
|
||||
target[property] = objectMerge(target[property], sourceProperty);
|
||||
const sourceProperty = source[property]
|
||||
if (typeof sourceProperty === 'object') {
|
||||
target[property] = objectMerge(target[property], sourceProperty)
|
||||
} else {
|
||||
target[property] = sourceProperty;
|
||||
target[property] = sourceProperty
|
||||
}
|
||||
});
|
||||
return target;
|
||||
})
|
||||
return target
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -216,18 +214,18 @@ export function objectMerge(target, source) {
|
||||
*/
|
||||
export function toggleClass(element, className) {
|
||||
if (!element || !className) {
|
||||
return;
|
||||
return
|
||||
}
|
||||
let classString = element.className;
|
||||
const nameIndex = classString.indexOf(className);
|
||||
let classString = element.className
|
||||
const nameIndex = classString.indexOf(className)
|
||||
if (nameIndex === -1) {
|
||||
classString += "" + className;
|
||||
classString += '' + className
|
||||
} else {
|
||||
classString =
|
||||
classString.substr(0, nameIndex) +
|
||||
classString.substr(nameIndex + className.length);
|
||||
classString.substr(nameIndex + className.length)
|
||||
}
|
||||
element.className = classString;
|
||||
element.className = classString
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -235,10 +233,10 @@ export function toggleClass(element, className) {
|
||||
* @returns {Date}
|
||||
*/
|
||||
export function getTime(type) {
|
||||
if (type === "start") {
|
||||
return new Date().getTime() - 3600 * 1000 * 24 * 90;
|
||||
if (type === 'start') {
|
||||
return new Date().getTime() - 3600 * 1000 * 24 * 90
|
||||
} else {
|
||||
return new Date(new Date().toDateString());
|
||||
return new Date(new Date().toDateString())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,38 +247,38 @@ export function getTime(type) {
|
||||
* @return {*}
|
||||
*/
|
||||
export function debounce(func, wait, immediate) {
|
||||
let timeout, args, context, timestamp, result;
|
||||
let timeout, args, context, timestamp, result
|
||||
|
||||
const later = function() {
|
||||
const later = function () {
|
||||
// 据上一次触发时间间隔
|
||||
const last = +new Date() - timestamp;
|
||||
const last = +new Date() - timestamp
|
||||
|
||||
// 上次被包装函数被调用时间间隔 last 小于设定时间间隔 wait
|
||||
if (last < wait && last > 0) {
|
||||
timeout = setTimeout(later, wait - last);
|
||||
timeout = setTimeout(later, wait - last)
|
||||
} else {
|
||||
timeout = null;
|
||||
timeout = null
|
||||
// 如果设定为immediate===true,因为开始边界已经调用过了此处无需调用
|
||||
if (!immediate) {
|
||||
result = func.apply(context, args);
|
||||
if (!timeout) context = args = null;
|
||||
result = func.apply(context, args)
|
||||
if (!timeout) context = args = null
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return function(...args) {
|
||||
context = this;
|
||||
timestamp = +new Date();
|
||||
const callNow = immediate && !timeout;
|
||||
return function (...args) {
|
||||
context = this
|
||||
timestamp = +new Date()
|
||||
const callNow = immediate && !timeout
|
||||
// 如果延时不存在,重新设定延时
|
||||
if (!timeout) timeout = setTimeout(later, wait);
|
||||
if (!timeout) timeout = setTimeout(later, wait)
|
||||
if (callNow) {
|
||||
result = func.apply(context, args);
|
||||
context = args = null;
|
||||
result = func.apply(context, args)
|
||||
context = args = null
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -291,18 +289,18 @@ export function debounce(func, wait, immediate) {
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function deepClone(source) {
|
||||
if (!source && typeof source !== "object") {
|
||||
throw new Error("error arguments", "deepClone");
|
||||
if (!source && typeof source !== 'object') {
|
||||
throw new Error('error arguments', 'deepClone')
|
||||
}
|
||||
const targetObj = source.constructor === Array ? [] : {};
|
||||
const targetObj = source.constructor === Array ? [] : {}
|
||||
Object.keys(source).forEach(keys => {
|
||||
if (source[keys] && typeof source[keys] === "object") {
|
||||
targetObj[keys] = deepClone(source[keys]);
|
||||
if (source[keys] && typeof source[keys] === 'object') {
|
||||
targetObj[keys] = deepClone(source[keys])
|
||||
} else {
|
||||
targetObj[keys] = source[keys];
|
||||
targetObj[keys] = source[keys]
|
||||
}
|
||||
});
|
||||
return targetObj;
|
||||
})
|
||||
return targetObj
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -310,16 +308,16 @@ export function deepClone(source) {
|
||||
* @returns {Array}
|
||||
*/
|
||||
export function uniqueArr(arr) {
|
||||
return Array.from(new Set(arr));
|
||||
return Array.from(new Set(arr))
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
export function createUniqueString() {
|
||||
const timestamp = +new Date() + "";
|
||||
const randomNum = parseInt((1 + Math.random()) * 65536) + "";
|
||||
return (+(randomNum + timestamp)).toString(32);
|
||||
const timestamp = +new Date() + ''
|
||||
const randomNum = parseInt((1 + Math.random()) * 65536) + ''
|
||||
return (+(randomNum + timestamp)).toString(32)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -329,7 +327,7 @@ export function createUniqueString() {
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function hasClass(ele, cls) {
|
||||
return !!ele.className.match(new RegExp("(\\s|^)" + cls + "(\\s|$)"));
|
||||
return !!ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'))
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -338,7 +336,7 @@ export function hasClass(ele, cls) {
|
||||
* @param {string} cls
|
||||
*/
|
||||
export function addClass(ele, cls) {
|
||||
if (!hasClass(ele, cls)) ele.className += " " + cls;
|
||||
if (!hasClass(ele, cls)) ele.className += ' ' + cls
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -348,45 +346,45 @@ export function addClass(ele, cls) {
|
||||
*/
|
||||
export function removeClass(ele, cls) {
|
||||
if (hasClass(ele, cls)) {
|
||||
const reg = new RegExp("(\\s|^)" + cls + "(\\s|$)");
|
||||
ele.className = ele.className.replace(reg, " ");
|
||||
const reg = new RegExp('(\\s|^)' + cls + '(\\s|$)')
|
||||
ele.className = ele.className.replace(reg, ' ')
|
||||
}
|
||||
}
|
||||
|
||||
// 替换邮箱字符
|
||||
export function regEmail(email) {
|
||||
if (String(email).indexOf("@") > 0) {
|
||||
const str = email.split("@");
|
||||
let _s = "";
|
||||
if (String(email).indexOf('@') > 0) {
|
||||
const str = email.split('@')
|
||||
let _s = ''
|
||||
if (str[0].length > 3) {
|
||||
for (var i = 0; i < str[0].length - 3; i++) {
|
||||
_s += "*";
|
||||
_s += '*'
|
||||
}
|
||||
}
|
||||
var new_email = str[0].substr(0, 3) + _s + "@" + str[1];
|
||||
var new_email = str[0].substr(0, 3) + _s + '@' + str[1]
|
||||
}
|
||||
return new_email;
|
||||
return new_email
|
||||
}
|
||||
|
||||
// 替换手机字符
|
||||
export function regMobile(mobile) {
|
||||
if (mobile.length > 7) {
|
||||
var new_mobile = mobile.substr(0, 3) + "****" + mobile.substr(7);
|
||||
var new_mobile = mobile.substr(0, 3) + '****' + mobile.substr(7)
|
||||
}
|
||||
return new_mobile;
|
||||
return new_mobile
|
||||
}
|
||||
|
||||
// 下载文件
|
||||
export function downloadFile(obj, name, suffix) {
|
||||
const url = window.URL.createObjectURL(new Blob([obj]));
|
||||
const link = document.createElement("a");
|
||||
link.style.display = "none";
|
||||
link.href = url;
|
||||
const fileName = parseTime(new Date()) + "-" + name + "." + suffix;
|
||||
link.setAttribute("download", fileName);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
const url = window.URL.createObjectURL(new Blob([obj]))
|
||||
const link = document.createElement('a')
|
||||
link.style.display = 'none'
|
||||
link.href = url
|
||||
const fileName = parseTime(new Date()) + '-' + name + '.' + suffix
|
||||
link.setAttribute('download', fileName)
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -400,41 +398,3 @@ export function RandomNumBoth(Max, Min = 0) {
|
||||
var num = Min + Math.round(Rand * Range); //四舍五入
|
||||
return num;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是不是PC浏览器
|
||||
* @returns
|
||||
*/
|
||||
export function isPcBowser() {
|
||||
if (!window.navigator) {
|
||||
return false;
|
||||
} else {
|
||||
if (/Mobile|Android|webOS|iPhone|iPad|Phone/i.test(navigator.userAgent)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保留小数n位,不进行四舍五入
|
||||
* num你传递过来的数字,
|
||||
* decimal你保留的几位,默认保留小数后两位
|
||||
* isInt 是否保留0
|
||||
*/
|
||||
export function formatDecimal(num, decimal = 2, isInt = false) {
|
||||
num = num.toFixed(3).toString();
|
||||
const index = num.indexOf(".");
|
||||
if (index !== -1) {
|
||||
num = num.substring(0, decimal + index + 1);
|
||||
} else {
|
||||
num = num.substring(0);
|
||||
}
|
||||
//截取后保留两位小数
|
||||
if (isInt) {
|
||||
return parseFloat(num);
|
||||
} else {
|
||||
return parseFloat(num).toFixed(decimal);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
import axios from 'axios'
|
||||
import router from '@/router/routers'
|
||||
import { Notification } from 'element-ui'
|
||||
import store from '../store'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import Config from '@/settings'
|
||||
import Cookies from 'js-cookie'
|
||||
|
||||
// 创建axios实例
|
||||
const service = axios.create({
|
||||
baseURL: process.env.NODE_ENV === 'production' ? process.env.VUE_APP_PHP_API: '/source',
|
||||
// baseURL: process.env.VUE_APP_PHP_API, // api 的 base_url
|
||||
timeout: Config.timeout // 请求超时时间
|
||||
})
|
||||
|
||||
// request拦截器
|
||||
service.interceptors.request.use(
|
||||
config => {
|
||||
// if (getToken()) {
|
||||
// config.headers['Authorization'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
// }
|
||||
config.headers['Content-Type'] = 'text/html; charset=UTF-8'
|
||||
// config.headers['loginName'] = 'admin'
|
||||
// config.headers['token'] = 'eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyVHlwZSI6Ik1HIiwiZXhwIjoxNjkwMTgwNzE2LCJ1c2VySWQiOiIyNDQiLCJpYXQiOjE2ODg3MDk0ODcsImxvZ2luTmFtZSI6ImFkbWluIn0.lqxxvv2-FcecQngMBorz4MpkB3mIJQDG-IUULQyV-KQ'
|
||||
// config.headers["userId"] = '244'
|
||||
return config
|
||||
},
|
||||
error => {
|
||||
Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
// response 拦截器
|
||||
service.interceptors.response.use(
|
||||
response => {
|
||||
return response.data
|
||||
},
|
||||
error => {
|
||||
console.log(error);
|
||||
// 兼容blob下载出错json提示
|
||||
if (error.response.data instanceof Blob && error.response.data.type.toLowerCase().indexOf('json') !== -1) {
|
||||
const reader = new FileReader()
|
||||
reader.readAsText(error.response.data, 'utf-8')
|
||||
reader.onload = function (e) {
|
||||
const errorMsg = JSON.parse(reader.result).message
|
||||
Notification.error({
|
||||
title: errorMsg,
|
||||
duration: 5000
|
||||
})
|
||||
}
|
||||
} else {
|
||||
let code = 0
|
||||
try {
|
||||
code = error.response.data.status
|
||||
} catch (e) {
|
||||
if (error.toString().indexOf('Error: timeout') !== -1) {
|
||||
Notification.error({
|
||||
title: '网络请求超时',
|
||||
duration: 5000
|
||||
})
|
||||
return Promise.reject(error)
|
||||
}
|
||||
}
|
||||
console.log(code)
|
||||
if (code) {
|
||||
if (code === 401) {
|
||||
store.dispatch('LogOut').then(() => {
|
||||
// 用户登录界面提示
|
||||
Cookies.set('point', 401)
|
||||
location.reload()
|
||||
})
|
||||
} else if (code === 403) {
|
||||
router.push({ path: '/401' })
|
||||
} else {
|
||||
const errorMsg = error.response.data.message
|
||||
if (errorMsg !== undefined) {
|
||||
Notification.error({
|
||||
title: errorMsg,
|
||||
duration: 5000
|
||||
})
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Notification.error({
|
||||
title: '接口请求失败',
|
||||
duration: 5000
|
||||
})
|
||||
}
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
export default service
|
||||
@@ -1,166 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="head-container flex">
|
||||
<el-button type="primary" icon="el-icon-plus" @click="$refs.addSong.show()">
|
||||
添加歌曲
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<div class="flex">
|
||||
<span>歌手页地址:</span>
|
||||
<a class="cursor-pointer" target="_blank" :href="singgerUrl">{{singgerUrl}}</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="head-container" id="table_drag">
|
||||
<el-table :data="tableData.list" v-loading="tableData.loading" row-key="id">
|
||||
<el-table-column label="排序" sortable prop="sort"></el-table-column>
|
||||
<el-table-column label="id" prop="id"></el-table-column>
|
||||
<el-table-column label="歌曲图片" prop="img">
|
||||
<template v-slot="scope">
|
||||
<el-image :src="scope.row.img"
|
||||
style="width:40px;height: 40px;border-radius: 4px;background-color: #efefef;">
|
||||
<div class="img_error" slot="error">
|
||||
<i class="icon el-icon-document-delete"></i>
|
||||
</div>
|
||||
</el-image>
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column label="歌曲名称" prop="name"></el-table-column>
|
||||
<el-table-column label="演出歌手" prop="singer"></el-table-column>
|
||||
<el-table-column label="单价" prop="price"></el-table-column>
|
||||
<el-table-column label="点唱次数" prop="salesNumber"></el-table-column>
|
||||
<el-table-column label="歌曲状态" prop="status">
|
||||
<template v-slot="scope">
|
||||
<el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0"
|
||||
@change="showChange($event, scope.row)"></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="240">
|
||||
<template v-slot="scope">
|
||||
<!-- <el-button type="text" icon="el-icon-rank" v-if="isPcBowser">排序</el-button>
|
||||
<el-button type="text" size="mini" round icon="el-icon-edit" @click="$refs.addSong.show(scope.row)"
|
||||
style="margin-left: 20px !important;">编辑</el-button> -->
|
||||
<el-button type="text" size="mini" round icon="el-icon-edit" @click="$refs.addSong.show(scope.row)">编辑</el-button>
|
||||
<el-popconfirm title="确定删除吗?" @confirm="delHandle([scope.row.id])">
|
||||
<el-button type="text" size="mini" round icon="el-icon-delete" slot="reference">
|
||||
删除
|
||||
</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<addSong ref="addSong" @success="addSongSuccess"></addSong>
|
||||
<el-pagination @size-change="paginationSizeChange" :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
||||
@current-change="paginationChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Sortable from 'sortablejs'
|
||||
import {
|
||||
tbShopSonglist,tbShopSongDel,tbShopSongEdit
|
||||
} from '@/api/application-song'
|
||||
import addSong from './componentsCompoents/add-song.vue'
|
||||
export default {
|
||||
components: {
|
||||
addSong
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
singgerUrl:'',
|
||||
tableData: {
|
||||
page: 0,
|
||||
size: 10,
|
||||
total: 0,
|
||||
loading: false,
|
||||
list: []
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getTableData()
|
||||
},
|
||||
methods: {
|
||||
jumpUrl(url){
|
||||
window.open(url)
|
||||
},
|
||||
addSongSuccess() {
|
||||
this.getTableData()
|
||||
},
|
||||
paginationSizeChange(e){
|
||||
this.tableData.size = e
|
||||
this.getTableData()
|
||||
},
|
||||
async showChange(e,row){
|
||||
try {
|
||||
this.tableData.loading = true
|
||||
const data = { ...row }
|
||||
data.status = e
|
||||
await tbShopSongEdit(data, 'put')
|
||||
this.getTableData()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
this.tableData.loading = false
|
||||
}
|
||||
},
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.tableData.page = 0;
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1
|
||||
this.getTableData()
|
||||
},
|
||||
// 删除
|
||||
async delHandle(ids) {
|
||||
try {
|
||||
await tbShopSongDel(ids)
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: `删除成功`,
|
||||
type: 'success'
|
||||
});
|
||||
this.getTableData()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
// 获取音乐列表
|
||||
async getTableData() {
|
||||
try {
|
||||
this.tableData.loading = true
|
||||
const res = await tbShopSonglist({
|
||||
page: this.tableData.page+1,
|
||||
size: this.tableData.size,
|
||||
sort: 'id',
|
||||
shopId: localStorage.getItem('shopId')
|
||||
})
|
||||
this.tableData.loading = false
|
||||
this.tableData.list = res.content
|
||||
this.tableData.total = res.totalElements
|
||||
const baseUrl=location.hostname==='localhost'? 'https://admintestweb.sxczgkj.cn': location.origin
|
||||
this.singgerUrl = baseUrl+'/song-H5/index.html?t='+res.songUrl
|
||||
} catch (error) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.flex{
|
||||
display: flex;
|
||||
align-content: center;
|
||||
}
|
||||
.cursor-pointer{
|
||||
cursor: pointer;
|
||||
color: #1890ff!important;
|
||||
transition: all 0.3s;
|
||||
font-size: 16px;
|
||||
}
|
||||
.cursor-pointer:hover{
|
||||
opacity: .7;
|
||||
}
|
||||
</style>
|
||||
@@ -1,388 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog :title="form.id ? '编辑酒品' : '添加酒品'" :visible.sync="dialogVisible" @close="reset">
|
||||
<div class="head-container" v-if="!form.id">
|
||||
<div class="tab_wrap">
|
||||
<div class="tab" :style="{ '--index': form.source }">
|
||||
<div class="item" v-for="(item, index) in tabs" :key="item.value"
|
||||
:class="{ active: index == form.source }" @click="tabChange(item)">
|
||||
{{ item.label }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="left">
|
||||
<template v-if="form.source == 0">
|
||||
<el-form-item label="酒品名" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入酒品名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="酒品图片">
|
||||
<uploadImg ref="uploadImg" :limit="1" @success="e => form.imgUrl = e[0]"
|
||||
@remove="form.imgUrl = ''" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="!form.id">
|
||||
<el-form-item label="选择商品" prop="name">
|
||||
<div>
|
||||
<el-button type="primary" icon="el-icon-plus"
|
||||
@click="$refs.shopListRef.show([...productIds])">
|
||||
添加商品
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="shop_list">
|
||||
<div class="item_wrap" v-for="(item, index) in productIds" :key="item.id"
|
||||
@click="productIds.splice(index, 1)">
|
||||
<div class="item" :data-index="index + 1">
|
||||
<el-image :src="item.coverImg" style="width: 100%;height: 100%;"></el-image>
|
||||
</div>
|
||||
<div class="name">{{ item.name }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-form-item label="商品">
|
||||
<div class="goods_info">
|
||||
<el-image :src="form.imgUrl" style="width: 50px;height: 50px;"></el-image>
|
||||
<div class="info">{{ form.name }}</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</template>
|
||||
<el-form-item label="单位">
|
||||
<el-input v-model="form.unit" placeholder="请输入单位" style="width: 200px;" />
|
||||
<!-- <el-select v-model="form.unitId" placeholder="请选择单位" style="width: 200px;" @change="selectUnitt">
|
||||
<el-option :label="item.name" :value="item.id" v-for="item in units" :key="item.id"></el-option>
|
||||
</el-select>
|
||||
<el-button type="primary" plain icon="el-icon-plus"
|
||||
@click="$refs.addUnitRef.show()">添加单位</el-button> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="有效期(天)">
|
||||
<el-input-number v-model="form.period" controls-position="right" step-strictly :min="1"
|
||||
placeholder="请输入有效期(天)"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="onSubmitHandle">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<addUnit ref="addUnitRef" @success="tbShopUnit" />
|
||||
<shopList ref="shopListRef" @success="slectShop" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { tbShopStorageGood } from '@/api/application'
|
||||
import { queryAllShopUser, tbShopUnit } from '@/api/shop'
|
||||
import uploadImg from '@/components/uploadImg'
|
||||
import addUnit from '@/views/product/components/addUnit'
|
||||
import shopList from '@/components/shopList'
|
||||
export default {
|
||||
components: {
|
||||
uploadImg,
|
||||
addUnit,
|
||||
shopList
|
||||
},
|
||||
data() {
|
||||
const nameValidator = (rule, value, callback) => {
|
||||
if (this.form.source == 0) {
|
||||
if (!this.form.name) {
|
||||
callback(new Error('请输入酒名名'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
} else {
|
||||
if (!this.productIds.length) {
|
||||
callback(new Error('请选择商品'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
dialogVisible: false,
|
||||
tabs: [
|
||||
{
|
||||
value: 0,
|
||||
label: '手动添加'
|
||||
},
|
||||
{
|
||||
value: 1,
|
||||
label: '从商品添加'
|
||||
}
|
||||
],
|
||||
units: [],
|
||||
loading: false,
|
||||
options: [],
|
||||
productIds: [],
|
||||
form: {
|
||||
name: '',
|
||||
imgUrl: '',
|
||||
source: 0,
|
||||
id: '',
|
||||
goods: [
|
||||
{
|
||||
imgUrl: '',
|
||||
name: '',
|
||||
}
|
||||
],
|
||||
period: '',
|
||||
unit: ''
|
||||
},
|
||||
resetForm: '',
|
||||
rules: {
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
validator: nameValidator,
|
||||
trigger: 'change'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.resetForm = { ...this.form }
|
||||
// this.getTableData()
|
||||
this.tbShopUnit()
|
||||
},
|
||||
methods: {
|
||||
slectShop(res) {
|
||||
if (this.productIds.length) {
|
||||
res.map(async item => {
|
||||
if (!await this.checkShop(item.id)) {
|
||||
this.productIds.push({ ...item })
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.productIds = res
|
||||
}
|
||||
},
|
||||
selectUnitt(e) {
|
||||
this.form.unit = this.units.find(item => item.id == e).name
|
||||
},
|
||||
// 获取单位
|
||||
async tbShopUnit() {
|
||||
try {
|
||||
const res = await tbShopUnit({
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
sort: 'id',
|
||||
page: 0,
|
||||
size: 100
|
||||
})
|
||||
this.units = res.content
|
||||
} catch (error) { }
|
||||
},
|
||||
// 切换类型
|
||||
tabChange(item) {
|
||||
this.form.source = this.tabs.findIndex(i => i.value == item.value)
|
||||
},
|
||||
// 获取用户列表
|
||||
async getTableData(query = '') {
|
||||
this.loading = true
|
||||
try {
|
||||
const res = await queryAllShopUser({
|
||||
telephone: query,
|
||||
})
|
||||
this.loading = false
|
||||
this.options = res.content
|
||||
} catch (error) {
|
||||
this.loading = false
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
// 提交
|
||||
onSubmitHandle() {
|
||||
this.$refs.form.validate(async valid => {
|
||||
if (valid) {
|
||||
try {
|
||||
if (this.form.source == 0) {
|
||||
// 手动大导入
|
||||
this.form.goods = [{
|
||||
name: this.form.name,
|
||||
imgUrl: this.form.imgUrl
|
||||
}]
|
||||
} else {
|
||||
this.form.goods = this.productIds.map(item => {
|
||||
return {
|
||||
name: item.name,
|
||||
imgUrl: item.coverImg
|
||||
}
|
||||
})
|
||||
}
|
||||
let res = await tbShopStorageGood(this.form, this.form.id ? 'put' : 'post')
|
||||
this.$emit('success', res)
|
||||
this.close()
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: `${this.form.id ? '编辑' : '添加'}成功`,
|
||||
type: 'success'
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
show(obj) {
|
||||
this.dialogVisible = true
|
||||
if (obj && obj.id) {
|
||||
this.form = obj
|
||||
if (obj.imgUrl && obj.source == 0) {
|
||||
setTimeout(() => {
|
||||
this.$refs.uploadImg.fileList = [
|
||||
{
|
||||
url: obj.imgUrl
|
||||
}
|
||||
]
|
||||
}, 100)
|
||||
}
|
||||
}
|
||||
},
|
||||
close() {
|
||||
this.dialogVisible = false
|
||||
},
|
||||
reset() {
|
||||
if (this.form.source == 0) {
|
||||
this.$refs.uploadImg.clearFiles()
|
||||
}
|
||||
this.form = { ...this.resetForm }
|
||||
this.$refs.form.resetFields()
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.goods_info {
|
||||
background-color: #f9f9f9;
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
padding-left: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.head-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.tab_wrap {
|
||||
background-color: #DCF0E8;
|
||||
padding: 4px;
|
||||
|
||||
.tab {
|
||||
--w: 120px;
|
||||
height: 35px;
|
||||
display: flex;
|
||||
position: relative;
|
||||
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
width: var(--w);
|
||||
height: inherit;
|
||||
background-color: #39D47A;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: calc(var(--index) * var(--w));
|
||||
z-index: 1;
|
||||
transition: left .3s ease-in-out;
|
||||
}
|
||||
|
||||
.item {
|
||||
width: var(--w);
|
||||
height: inherit;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
color: #39D47A;
|
||||
transition: all .1s ease-in-out .15s;
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&.active {
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.shop_list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.item_wrap {
|
||||
$size: 80px;
|
||||
|
||||
.item {
|
||||
$radius: 4px;
|
||||
width: $size;
|
||||
height: $size;
|
||||
border-radius: $radius;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
margin-right: 10px;
|
||||
margin-top: 10px;
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&::after {
|
||||
content: attr(data-index);
|
||||
font-size: 12px;
|
||||
height: 20px;
|
||||
display: flex;
|
||||
padding: 0 10px;
|
||||
border-radius: 0 0 $radius 0;
|
||||
align-items: center;
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
backdrop-filter: blur(10px);
|
||||
color: #fff;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
&::before {
|
||||
content: '删除';
|
||||
font-size: 12px;
|
||||
width: 100%;
|
||||
height: 20px;
|
||||
display: flex;
|
||||
padding: 0 10px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
backdrop-filter: blur(10px);
|
||||
color: #fff;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 10;
|
||||
transition: all .1s ease-in-out;
|
||||
}
|
||||
}
|
||||
|
||||
.name {
|
||||
width: $size;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,145 +0,0 @@
|
||||
<template>
|
||||
<div class="head-container">
|
||||
<div class="head-container">
|
||||
<el-form :model="query" inline>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="$refs.addModal.show()">添加酒品</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="搜索">
|
||||
<el-input v-model="query.name" placeholder="酒名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.data" v-loading="tableData.loading">
|
||||
<el-table-column label="酒名" prop="name">
|
||||
<template v-slot="scope">
|
||||
<div style="display: flex;align-items: center;">
|
||||
<el-image :src="scope.row.imgUrl"
|
||||
style="width:40px;height: 40px;border-radius: 4px;background-color: #efefef;">
|
||||
<div class="img_error" slot="error">
|
||||
<i class="icon el-icon-document-delete"></i>
|
||||
</div>
|
||||
</el-image>
|
||||
<span style="margin-left: 10px;">{{ scope.row.name }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位" prop="unit">
|
||||
<template v-slot="scope">
|
||||
<el-tag type="primary">{{ scope.row.unit }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="有效期(天)" prop="period"></el-table-column>
|
||||
<el-table-column label="来源" prop="source">
|
||||
<template v-slot="scope">
|
||||
<span v-if="scope.row.source == 0">手动导入</span>
|
||||
<span v-if="scope.row.source == 1">商品导入</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="120">
|
||||
<template v-slot="scope">
|
||||
<div style="display: flex;gap: 10px;">
|
||||
<el-button type="text"
|
||||
@click="$refs.winAddModal.show({ name: scope.row.name, imgUrl: scope.row.imgUrl, expDay: scope.row.period, unit: scope.row.unit }, true)">存酒</el-button>
|
||||
<el-button type="text" @click="$refs.addModal.show(scope.row)">编辑</el-button>
|
||||
<el-popconfirm title="确定删除吗?" @confirm="delHandle(scope.row)">
|
||||
<el-button type="text" slot="reference">删除</el-button>
|
||||
</el-popconfirm>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
||||
@current-change="paginationChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
</div>
|
||||
<addModal ref="addModal" @success="getTableData" />
|
||||
<winAddModal ref="winAddModal" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { tbShopStorageGoodlist, tbShopStorageGood } from '@/api/application'
|
||||
import addModal from './addModal'
|
||||
import winAddModal from '../winestorage/addModal'
|
||||
export default {
|
||||
components: {
|
||||
addModal,
|
||||
winAddModal
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
statusList: [
|
||||
{
|
||||
value: 0,
|
||||
label: '已取完'
|
||||
},
|
||||
{
|
||||
value: 1,
|
||||
label: '未取完'
|
||||
}
|
||||
],
|
||||
query: {
|
||||
name: ""
|
||||
},
|
||||
tableData: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 10,
|
||||
loading: false,
|
||||
total: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getTableData()
|
||||
},
|
||||
methods: {
|
||||
// 删除
|
||||
async delHandle(row) {
|
||||
try {
|
||||
let obj = { ...row }
|
||||
obj.isDel = 1
|
||||
await tbShopStorageGood(obj, 'put')
|
||||
this.$notify.success('删除成功')
|
||||
this.getTableData()
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.tableData.page = 0;
|
||||
this.query.name = ''
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1;
|
||||
this.getTableData()
|
||||
},
|
||||
// 获取商品列表
|
||||
async getTableData() {
|
||||
this.tableData.loading = true
|
||||
try {
|
||||
const res = await tbShopStorageGoodlist({
|
||||
name: this.query.name,
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size
|
||||
})
|
||||
this.tableData.loading = false
|
||||
this.tableData.data = res.content
|
||||
this.tableData.total = res.totalElements
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,188 +0,0 @@
|
||||
<template>
|
||||
<el-dialog :title="form.id ? '编辑存酒' : '添加存酒'" width="500px" :visible.sync="dialogVisible" @close="reset">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="left">
|
||||
<template v-if="!form.id">
|
||||
<el-form-item label="选择用户" prop="userid">
|
||||
<el-select v-model="form.userid" placeholder="请输入用户昵称" filterable remote
|
||||
:remote-method="queryAllShopUser" :loading="loading" @change="userChange">
|
||||
<el-option v-for="item in options" :key="item.id" :label="`${item.nickName}-${item.telephone}`"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="选择酒品">
|
||||
<el-select v-model="form.name" @change="wineChange" v-if="!wine">
|
||||
<el-option :label="item.name" :value="item.name" v-for="(item, index) in wineList"
|
||||
:key="index"></el-option>
|
||||
</el-select>
|
||||
<div class="goods_info" v-else>
|
||||
<el-image :src="form.imgUrl" style="width: 50px;height: 50px;"></el-image>
|
||||
<div class="info">{{ form.name }}</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量">
|
||||
<el-input-number v-model="form.num" :step="1" step-strictly :min="1"></el-input-number>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<el-form-item label="数量" v-else>
|
||||
<el-input-number v-model="num" :step="1" step-strictly :min="1" :max="form.num"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="onSubmitHandle">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { queryAllShopUser } from '@/api/shop'
|
||||
import { tbShopStorageGoodlist, storageWin, storagePut } from '@/api/application'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
loading: false,
|
||||
options: [],
|
||||
num: '',
|
||||
wine: false,
|
||||
form: {
|
||||
id: '',
|
||||
imgUrl: '',
|
||||
name: '',
|
||||
nickname: '',
|
||||
num: 1,
|
||||
status: '',
|
||||
telphone: '',
|
||||
unit: '',
|
||||
userid: '',
|
||||
expDay: ''
|
||||
},
|
||||
resetForm: '',
|
||||
rules: {
|
||||
userid: [
|
||||
{
|
||||
required: true,
|
||||
message: ' ',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
},
|
||||
wineList: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.resetForm = { ...this.form }
|
||||
this.queryAllShopUser()
|
||||
this.tbShopStorageGoodlist()
|
||||
},
|
||||
methods: {
|
||||
// 选择用户
|
||||
userChange(e) {
|
||||
let user = this.options.find(item => item.id == e)
|
||||
this.form.nickname = user.nickName
|
||||
this.form.telphone = user.telephone
|
||||
},
|
||||
// 选择酒品
|
||||
wineChange(e) {
|
||||
let wine = this.wineList.find(item => item.name == e)
|
||||
this.form.imgUrl = wine.imgUrl
|
||||
this.form.expDay = wine.period
|
||||
this.form.unit = wine.unit
|
||||
},
|
||||
// 获取酒品列表
|
||||
async tbShopStorageGoodlist() {
|
||||
try {
|
||||
const res = await tbShopStorageGoodlist({
|
||||
page: 0,
|
||||
size: 100
|
||||
})
|
||||
this.wineList = res.content
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
// 获取用户列表
|
||||
async queryAllShopUser(query = '') {
|
||||
this.loading = true
|
||||
try {
|
||||
const res = await queryAllShopUser({
|
||||
name: query,
|
||||
})
|
||||
this.loading = false
|
||||
this.options = res.content
|
||||
} catch (error) {
|
||||
this.loading = false
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
// 提交
|
||||
onSubmitHandle() {
|
||||
console.log(this.form)
|
||||
this.$refs.form.validate(async valid => {
|
||||
if (valid) {
|
||||
try {
|
||||
let res = ''
|
||||
if (this.form.id) {
|
||||
res = await storagePut({
|
||||
id: this.form.id,
|
||||
num: this.num,
|
||||
type: 0
|
||||
})
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: `取酒成功`,
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
res = await storageWin(this.form)
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: `存酒成功`,
|
||||
type: 'success'
|
||||
});
|
||||
}
|
||||
this.$emit('success', res)
|
||||
this.close()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
async show(obj = {}, wine = false) {
|
||||
this.dialogVisible = true
|
||||
if (obj && obj.id) {
|
||||
this.form = { ...obj }
|
||||
}
|
||||
if (obj && obj.name) {
|
||||
this.form.name = obj.name
|
||||
this.form.imgUrl = obj.imgUrl
|
||||
this.form.expDay = obj.expDay
|
||||
this.form.unit = obj.unit
|
||||
}
|
||||
this.wine = wine
|
||||
},
|
||||
close() {
|
||||
this.dialogVisible = false
|
||||
},
|
||||
reset() {
|
||||
this.form = { ...this.resetForm }
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.goods_info {
|
||||
background-color: #f9f9f9;
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
padding-left: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,38 +0,0 @@
|
||||
<template>
|
||||
<el-dialog title="记录" width="500px" :visible.sync="dialogVisible">
|
||||
<el-steps :active="list.length" direction="vertical" :space="100">
|
||||
<el-step :title="item.content" :description="item.time" v-for="item in list" :key="item.id"></el-step>
|
||||
</el-steps>
|
||||
<el-empty description="暂无记录" v-if="!list.length"></el-empty>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { recordList } from '@/api/application'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
loading: false,
|
||||
list: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 查询存取酒记录
|
||||
async recordList(storageId) {
|
||||
try {
|
||||
this.loading = true
|
||||
const res = await recordList({ storageId: storageId })
|
||||
this.list = res.content
|
||||
this.loading = false
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
show(id) {
|
||||
this.dialogVisible = true
|
||||
this.recordList(id)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,166 +0,0 @@
|
||||
<template>
|
||||
<div class="head-container">
|
||||
<div class="head-container">
|
||||
<el-form :model="query" inline>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="$refs.addModal.show()">添加存酒</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="搜索">
|
||||
<el-input v-model="query.name" placeholder="酒名/用户昵称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号">
|
||||
<el-input v-model="query.telphone" placeholder="手机号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-select v-model="query.status">
|
||||
<el-option v-for="item in statusList" :key="item.value" :value="item.value"
|
||||
:label="item.label"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.data" v-loading="tableData.loading" row-key="id">
|
||||
<el-table-column label="用户名" prop="nickname">
|
||||
<template v-slot="scope">
|
||||
<div style="display: flex;align-items: center;">
|
||||
<el-image src=""
|
||||
style="width:40px;height: 40px;background-color: #efefef;display: flex;align-items: center;justify-content: center;">
|
||||
<i class="el-icon-folder-delete" slot="error" style="font-size: 20px;color: #999;"></i>
|
||||
</el-image>
|
||||
<span style="margin-left: 10px;">{{ scope.row.telphone }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="酒品名" prop="name">
|
||||
<template v-slot="scope">
|
||||
<div style="display: flex;align-items: center;">
|
||||
<el-image :src="scope.row.imgUrl" style="width:40px;height: 40px;">
|
||||
<i class="el-icon-folder-delete" slot="error"></i>
|
||||
</el-image>
|
||||
<span style="margin-left: 10px;">{{ scope.row.name }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" prop="name">
|
||||
<template v-slot="scope">
|
||||
<span>{{ scope.row.num }}({{ scope.row.unit }})</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="存酒时间" prop="savTime"></el-table-column>
|
||||
<el-table-column label="到期时间" prop="expTime"></el-table-column>
|
||||
<el-table-column label="状态" prop="status">
|
||||
<template v-slot="scope">
|
||||
<el-tag :type="statusList.find(item => item.value === scope.row.status).type">{{
|
||||
statusList.find(item => item.value === scope.row.status).label }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="120">
|
||||
<template v-slot="scope">
|
||||
<div style="display: flex;gap: 10px;">
|
||||
<el-button type="text" @click="$refs.HistoryModal.show(scope.row.id)">查看记录</el-button>
|
||||
<el-button type="text" v-if="scope.row.status == 0" disabled>已取完</el-button>
|
||||
<el-button type="text" @click="$refs.addModal.show(scope.row)"
|
||||
v-if="scope.row.status == 1">取酒</el-button>
|
||||
<el-button type="text" v-if="scope.row.status == 2" disabled>已过期</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
||||
@current-change="paginationChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
</div>
|
||||
<addModal ref="addModal" @success="getTableData" />
|
||||
<HistoryModal ref="HistoryModal" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import addModal from './addModal'
|
||||
import HistoryModal from './historyModal'
|
||||
import { storageList } from '@/api/application'
|
||||
export default {
|
||||
components: {
|
||||
addModal,
|
||||
HistoryModal
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
statusList: [
|
||||
{
|
||||
value: '',
|
||||
label: '全部',
|
||||
type: 'warning'
|
||||
},
|
||||
{
|
||||
value: 0,
|
||||
label: '已取完',
|
||||
type: 'warning'
|
||||
},
|
||||
{
|
||||
value: 1,
|
||||
label: '存储中',
|
||||
type: 'primary'
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
label: '已过期',
|
||||
type: 'info'
|
||||
}
|
||||
],
|
||||
query: {
|
||||
name: "",
|
||||
telphone: "",
|
||||
status: ''
|
||||
},
|
||||
tableData: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 10,
|
||||
loading: false,
|
||||
total: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getTableData()
|
||||
},
|
||||
methods: {
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.tableData.page = 0
|
||||
this.query.name = ''
|
||||
this.query.telphone = ''
|
||||
this.query.status = ''
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1;
|
||||
this.getTableData()
|
||||
},
|
||||
// 获取商品列表
|
||||
async getTableData() {
|
||||
try {
|
||||
this.tableData.loading = true
|
||||
const res = await storageList({
|
||||
...this.query,
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size
|
||||
})
|
||||
this.tableData.loading = false
|
||||
this.tableData.data = res.content
|
||||
this.tableData.total = res.totalElements
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,82 +0,0 @@
|
||||
<template>
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.data" v-loading="tableData.loading">
|
||||
<el-table-column label="商品信息">
|
||||
<template v-slot="scope">
|
||||
<div class="shop_info">
|
||||
<el-image :src="scope.row.imgUrl"
|
||||
style="width: 50px;height: 50px;border-radius: 4px;background-color: #efefef;">
|
||||
<div class="img_error" slot="error">
|
||||
<i class="icon el-icon-document-delete"></i>
|
||||
</div>
|
||||
</el-image>
|
||||
<div class="info">
|
||||
<span>{{ scope.row.name }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="有效存酒" prop="savNum"></el-table-column>
|
||||
<el-table-column label="已过期存酒" prop="expNum"></el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { countRecord } from '@/api/application'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tableData: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 10,
|
||||
loading: false,
|
||||
total: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getTableData()
|
||||
},
|
||||
methods: {
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1
|
||||
this.getTableData()
|
||||
},
|
||||
// 获取商品列表
|
||||
async getTableData() {
|
||||
try {
|
||||
this.tableData.loading = true
|
||||
const res = await countRecord({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size
|
||||
})
|
||||
this.tableData.loading = false
|
||||
this.tableData.data = res.content
|
||||
this.tableData.total = res.totalElements
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.shop_info {
|
||||
display: flex;
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
padding-left: 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.tag_wrap {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,172 +0,0 @@
|
||||
<template>
|
||||
<el-dialog :title="title" width="500px" :visible.sync="dialogVisible" @close="diaClose">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="left">
|
||||
<el-form-item label="歌曲图片">
|
||||
<uploadImg ref="uploadImg" :limit="1" @success="uploadSuccess" @remove="uploadRemove" />
|
||||
<div class="tips"></div>
|
||||
</el-form-item>
|
||||
<el-form-item label="歌曲名称" prop="name">
|
||||
<el-input v-model="form.name"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="原唱歌手">
|
||||
<el-input v-model="form.originSinger"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="演出歌手名称" prop="singer">
|
||||
<el-input v-model="form.singer"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="单价" prop="price">
|
||||
<el-input type="number" v-model="form.price"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input type="number" v-model="form.sort"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="onSubmitHandle">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uploadImg from '@/components/uploadImg'
|
||||
import {
|
||||
tbShopSongAdd,tbShopSongEdit
|
||||
} from '@/api/application-song'
|
||||
const form={
|
||||
img: '',
|
||||
name: '',
|
||||
singer: '',
|
||||
originSinger: '',
|
||||
price: 0,
|
||||
sort: 0
|
||||
}
|
||||
export default {
|
||||
components: {
|
||||
uploadImg
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: '',
|
||||
dialogVisible: false,
|
||||
rules: {
|
||||
name: [{
|
||||
required: true,
|
||||
message: '歌曲名称必填',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
singer: [{
|
||||
required: true,
|
||||
message: '演出歌手名称必填',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
price: [{
|
||||
required: true,
|
||||
message: '单价必填',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
sort: [{
|
||||
required: true,
|
||||
message: '排序必填',
|
||||
trigger: 'blur'
|
||||
}]
|
||||
},
|
||||
form:{...form}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
restForm(){
|
||||
console.log('restForm')
|
||||
console.log(form)
|
||||
this.form={...form}
|
||||
this.$refs.uploadImg.clearFiles()
|
||||
},
|
||||
diaClose(){
|
||||
this.restForm()
|
||||
},
|
||||
uploadSuccess(res) {
|
||||
this.form.img = res[0]
|
||||
console.log(this.form.img);
|
||||
},
|
||||
uploadRemove() {
|
||||
this.form.img = ''
|
||||
},
|
||||
// 提交
|
||||
onSubmitHandle() {
|
||||
console.log(this.form)
|
||||
this.$refs.form.validate(async valid => {
|
||||
if (valid) {
|
||||
try {
|
||||
let res = ''
|
||||
if (this.form.id) { //编辑
|
||||
res = await tbShopSongEdit(this.form)
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: `修改成功`,
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
//添加
|
||||
res = await tbShopSongAdd(this.form)
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: `添加成功`,
|
||||
type: 'success'
|
||||
});
|
||||
}
|
||||
this.close()
|
||||
|
||||
this.$emit('success', res)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
async show(obj = {}) {
|
||||
console.log(obj);
|
||||
// this.form=this.$options.data().form
|
||||
this.dialogVisible = true
|
||||
this.title='添加歌曲'
|
||||
|
||||
if (obj && obj.id) {
|
||||
this.title='编辑歌曲'
|
||||
this.form = {
|
||||
...obj
|
||||
}
|
||||
}
|
||||
if (obj && obj.hasOwnProperty('img')&&obj.img) {
|
||||
console.log(obj.img)
|
||||
this.form.img = obj.img
|
||||
requestAnimationFrame(()=>{
|
||||
this.$refs.uploadImg.fileList = [{
|
||||
url: obj.img
|
||||
}]
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
close() {
|
||||
this.restForm()
|
||||
this.dialogVisible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.goods_info {
|
||||
background-color: #f9f9f9;
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
padding-left: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,105 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="title">应用中心</div>
|
||||
<div class="list">
|
||||
<div class="item" v-for="item in list" :key="item.id" @click="to(item)">
|
||||
<img :src="item.coverImg" class="icon">
|
||||
<div class="info">
|
||||
<div class="name">{{ item.name }}</div>
|
||||
<div class="intro">
|
||||
{{ item.value }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { appCenterGet } from "@/api/application";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
list: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.appCenterGet()
|
||||
},
|
||||
methods: {
|
||||
// 跳转
|
||||
to(item) {
|
||||
localStorage.setItem('applocation', JSON.stringify(item))
|
||||
this.$router.push({
|
||||
name: item.absUrl
|
||||
})
|
||||
},
|
||||
// 获取应用列表
|
||||
async appCenterGet() {
|
||||
try {
|
||||
const res = await appCenterGet()
|
||||
this.list = res
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.title {
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
.list {
|
||||
padding: 20px 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 14px;
|
||||
|
||||
.item {
|
||||
width: 400px;
|
||||
background-color: #f5f5f5;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 14px;
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
|
||||
.info {
|
||||
.name {
|
||||
color: #39D47A;
|
||||
}
|
||||
|
||||
.intro {
|
||||
color: #39D47A;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
padding-left: 10px;
|
||||
|
||||
.name {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.intro {
|
||||
color: #999;
|
||||
margin-top: 4px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,143 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="header">
|
||||
<div class="item">
|
||||
<img :src="applocation.coverImg" class="icon">
|
||||
<div class="info">
|
||||
<div class="name">{{ applocation.name }}</div>
|
||||
<div class="intro">
|
||||
{{ applocation.value }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<div class="tab_wrap">
|
||||
<div class="tab" :style="{ '--index': tabActive }">
|
||||
<div class="item" v-for="item in tabs" :key="item.value" @click="tabChange(item)">
|
||||
{{ item.label }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<winestorageRecord v-if="tabActive == 0" />
|
||||
<wineRecord v-if="tabActive == 1" />
|
||||
<winetotal v-if="tabActive == 2" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import winestorageRecord from './components/winestorage/record.vue'
|
||||
import wineRecord from './components/wine/record.vue'
|
||||
import winetotal from './components/winetotal/winetotal.vue'
|
||||
export default {
|
||||
components: {
|
||||
winestorageRecord,
|
||||
wineRecord,
|
||||
winetotal
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
applocation: JSON.parse(localStorage.getItem('applocation')),
|
||||
tabActive: 0,
|
||||
tabs: [
|
||||
{
|
||||
value: 1,
|
||||
label: '存酒记录'
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
label: '可存酒管理'
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
label: '存酒统计'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
tabChange(item) {
|
||||
this.tabActive = this.tabs.findIndex(i => i.value == item.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.header {
|
||||
display: flex;
|
||||
|
||||
.item {
|
||||
flex: 1;
|
||||
background-color: #f5f5f5;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 14px;
|
||||
|
||||
.icon {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
padding-left: 10px;
|
||||
|
||||
.name {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.intro {
|
||||
color: #999;
|
||||
margin-top: 4px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tab_wrap {
|
||||
background-color: #f5f5f5;
|
||||
padding: 4px;
|
||||
margin-top: 20px;
|
||||
|
||||
.tab {
|
||||
--w: 150px;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
position: relative;
|
||||
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
width: var(--w);
|
||||
height: inherit;
|
||||
background-color: #fff;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: calc(var(--index) * var(--w));
|
||||
z-index: 1;
|
||||
transition: left .3s ease-in-out;
|
||||
}
|
||||
|
||||
.item {
|
||||
width: var(--w);
|
||||
height: inherit;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -5,17 +5,7 @@
|
||||
<el-tab-pane label="销量" name="2"></el-tab-pane>
|
||||
</el-tabs>
|
||||
<div class="head-container">
|
||||
<el-form :model="query" inline label-position="left">
|
||||
<template v-if="orderType == 2">
|
||||
<el-form-item>
|
||||
<el-input placeholder="商品名称" v-model="query.proName" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select v-model="query.cateId" placeholder="商品分类" style="width: 140px;">
|
||||
<el-option :label="item.name" :value="item.id" v-for="item in categorys" :key="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<el-form :model="query" label-position="left">
|
||||
<el-form-item>
|
||||
<el-radio-group v-model="timeValue" @change="timeChange">
|
||||
<el-radio-button label="">全部</el-radio-button>
|
||||
@@ -27,15 +17,24 @@
|
||||
<el-radio-button label="month">本月</el-radio-button>
|
||||
<el-radio-button label="custom">自定义</el-radio-button>
|
||||
</el-radio-group>
|
||||
<el-date-picker v-model="query.createdAt" type="daterange" range-separator="至" start-placeholder="开始日期"
|
||||
end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" value-format="yyyy-MM-dd HH:mm:ss"
|
||||
v-if="timeValue == 'custom'">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-date-picker
|
||||
v-model="query.createdAt"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="['00:00:00', '23:59:59']"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
v-if="timeValue == 'custom'"
|
||||
>
|
||||
</el-date-picker
|
||||
><el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
<el-button icon="el-icon-download" v-loading="downloadLoading" @click="downloadHandle">
|
||||
<el-button
|
||||
icon="el-icon-download"
|
||||
v-loading="downloadLoading"
|
||||
@click="downloadHandle"
|
||||
>
|
||||
<span v-if="!downloadLoading">导出Excel</span>
|
||||
<span v-else>下载中...</span>
|
||||
</el-button>
|
||||
@@ -49,95 +48,54 @@
|
||||
<i class="icon" :class="item.icon"></i>
|
||||
</div>
|
||||
<div class="info">
|
||||
<div class="m">
|
||||
<template v-if="item.isAmount == 1">¥</template>
|
||||
{{ item.payAmount }}
|
||||
</div>
|
||||
<div class="m">¥{{ item.payAmount }}</div>
|
||||
<div class="t">{{ item.payType }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.data" v-loading="tableData.loading" v-if="orderType == 1">
|
||||
<el-table
|
||||
:data="tableData.data"
|
||||
v-loading="tableData.loading"
|
||||
v-if="orderType == 1"
|
||||
>
|
||||
<el-table-column label="日期" prop="tradeDay"></el-table-column>
|
||||
<el-table-column label="营业额" prop="total">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.total }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="销售额" prop="total">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.total | totalfilter(scope.row.refund) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="微信小程序支付" prop="wxLite">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.wxLite }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="扫码支付金额" prop="scanCode">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.scanCode }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="现金支付金额" prop="cash">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.cash }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="会员充值" prop="cash">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.recharge }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="会员支付" prop="cash">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.deposit }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- <el-table-column label="充值金额" prop="cash">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.recharge }}
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="退款金额" prop="cash">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.refund }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="总金额" prop="total"></el-table-column>
|
||||
<el-table-column label="微信小程序支付" prop="wxLite"></el-table-column>
|
||||
<el-table-column label="扫码支付金额" prop="scanCode"></el-table-column>
|
||||
<el-table-column label="现金支付金额" prop="cash"></el-table-column>
|
||||
</el-table>
|
||||
<el-table :data="tableData.data" v-loading="tableData.loading" v-if="orderType == 2">
|
||||
<el-table
|
||||
:data="tableData.data"
|
||||
v-loading="tableData.loading"
|
||||
v-if="orderType == 2"
|
||||
>
|
||||
<el-table-column label="商品名称" prop="productName"></el-table-column>
|
||||
<el-table-column label="商品分类" prop="cateName"></el-table-column>
|
||||
<el-table-column label="商品描述" prop="productSkuName"></el-table-column>
|
||||
<el-table-column label="单价" prop="price"></el-table-column>
|
||||
<el-table-column
|
||||
label="商品描述"
|
||||
prop="productSkuName"
|
||||
></el-table-column>
|
||||
<el-table-column label="销量" prop="salesNum"></el-table-column>
|
||||
<el-table-column label="退单量" prop="refNum"></el-table-column>
|
||||
<el-table-column label="销售金额" prop="salesAmount">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.salesAmount }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="退款金额" prop="refAmount">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.refAmount }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="总量" prop="num"></el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
||||
@current-change="paginationChange" @size-change="sizeChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
<el-pagination
|
||||
:total="tableData.total"
|
||||
:current-page="tableData.page + 1"
|
||||
:page-size="tableData.size"
|
||||
@current-change="paginationChange"
|
||||
@size-change="sizeChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
></el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { daydownload, daycount, summaryday } from "@/api/home";
|
||||
import { tbShopCategoryGet } from '@/api/shop'
|
||||
import dayjs from "dayjs";
|
||||
import { downloadFile } from "@/utils/index";
|
||||
|
||||
@@ -147,11 +105,8 @@ export default {
|
||||
timeValue: "",
|
||||
resetQuery: null,
|
||||
orderType: "1",
|
||||
categorys: [],
|
||||
query: {
|
||||
createdAt: [],
|
||||
proName: '',
|
||||
cateId: ''
|
||||
createdAt: []
|
||||
},
|
||||
tableData: {
|
||||
data: [],
|
||||
@@ -168,55 +123,19 @@ export default {
|
||||
filters: {
|
||||
timeFilter(time) {
|
||||
return dayjs(time).format("YYYY-MM-DD HH:mm:ss");
|
||||
},
|
||||
totalfilter(item,d) {
|
||||
let num = item + d
|
||||
return num.toFixed(2)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.resetQuery = { ...this.query };
|
||||
this.getTableData();
|
||||
this.tbShopCategoryGet()
|
||||
},
|
||||
methods: {
|
||||
// 获取商品分类
|
||||
async tbShopCategoryGet() {
|
||||
try {
|
||||
const res = await tbShopCategoryGet({
|
||||
page: 0,
|
||||
size: 200,
|
||||
sort: 'id,desc',
|
||||
shopId: localStorage.getItem('shopId')
|
||||
})
|
||||
let categorys = []
|
||||
for (let item of res.content) {
|
||||
categorys.push({
|
||||
name: `|----${item.name}`,
|
||||
id: item.id
|
||||
})
|
||||
if (item.childrenList.length) {
|
||||
for (let val of item.childrenList) {
|
||||
categorys.push({
|
||||
name: `|----|----${val.name}`,
|
||||
id: val.id
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
this.categorys = categorys
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 获取订单汇总
|
||||
async daycount() {
|
||||
try {
|
||||
const res = await daycount({
|
||||
startTime: this.query.createdAt[0],
|
||||
endTime: this.query.createdAt[1],
|
||||
cateId: this.query.cateId,
|
||||
proName: this.query.proName
|
||||
endTime: this.query.createdAt[1]
|
||||
});
|
||||
this.payCountList = res;
|
||||
} catch (error) {
|
||||
@@ -230,9 +149,7 @@ export default {
|
||||
const file = await daydownload({
|
||||
type: this.orderType,
|
||||
startTime: this.query.createdAt[0],
|
||||
endTime: this.query.createdAt[1],
|
||||
cateId: this.query.cateId,
|
||||
proName: this.query.proName
|
||||
endTime: this.query.createdAt[1]
|
||||
});
|
||||
downloadFile(file, "数据", "xlsx");
|
||||
this.downloadLoading = false;
|
||||
@@ -267,9 +184,7 @@ export default {
|
||||
size: this.tableData.size,
|
||||
type: this.orderType,
|
||||
startTime: this.query.createdAt[0],
|
||||
endTime: this.query.createdAt[1],
|
||||
proName: this.query.proName,
|
||||
cateId: this.query.cateId
|
||||
endTime: this.query.createdAt[1]
|
||||
});
|
||||
this.tableData.loading = false;
|
||||
this.tableData.data = res.content;
|
||||
|
||||
@@ -1,384 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="head-container">
|
||||
<el-form :model="query" inline label-position="left">
|
||||
<el-radio-group v-model="timeValue" @change="timeChange">
|
||||
<el-radio-button label="">全部</el-radio-button>
|
||||
<el-radio-button label="0">今天</el-radio-button>
|
||||
<el-radio-button label="-1">昨天</el-radio-button>
|
||||
<el-radio-button label="-7">最近7天</el-radio-button>
|
||||
<el-radio-button label="-30">最近30天</el-radio-button>
|
||||
<el-radio-button label="week">本周</el-radio-button>
|
||||
<el-radio-button label="month">本月</el-radio-button>
|
||||
<el-radio-button label="custom">自定义</el-radio-button>
|
||||
</el-radio-group>
|
||||
<el-date-picker v-model="query.createdAt" type="daterange" range-separator="至" start-placeholder="开始日期"
|
||||
end-placeholder="结束日期" :clearable="false" :default-time="['00:00:00', '23:59:59']"
|
||||
value-format="yyyyMMdd">
|
||||
</el-date-picker>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.data" v-loading="tableData.loading" v-if="orderType == 1">
|
||||
|
||||
<el-table-column type="index" width="50">
|
||||
</el-table-column>
|
||||
<el-table-column label="商户名称" prop="merchantName"> </el-table-column>
|
||||
<el-table-column label="职员名称" prop="staffName"></el-table-column>
|
||||
<el-table-column label="订单数量" prop="orderNum"></el-table-column>
|
||||
<el-table-column label="应交金额" prop="payable"></el-table-column>
|
||||
<el-table-column label="上交金额" prop="handIn"></el-table-column>
|
||||
<el-table-column label="快捷收款金额" prop="quickAmount"></el-table-column>
|
||||
<el-table-column label="退款金额" prop="returnAmount"></el-table-column>
|
||||
<el-table-column label="总收入" prop="totalAmount"></el-table-column>
|
||||
<el-table-column label="备用金" prop="imprest"></el-table-column>
|
||||
<el-table-column label="开始时间" prop="startTime">
|
||||
<template v-slot="scope">
|
||||
<div>
|
||||
{{ scope.row.startTime }}
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="交班时间" prop="endTime">
|
||||
<template v-slot="scope">
|
||||
<div>
|
||||
{{ scope.row.endTime }}
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="" width='120px'>
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" @click="clicksee(scope.row)">查看</el-button>
|
||||
<el-button type="text" @click="clickexport(scope.row)">导出</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
||||
@current-change="paginationChange" @size-change="sizeChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
</div>
|
||||
<el-dialog title="商品销量" :visible.sync="dialogshow">
|
||||
<el-table :data="tableDatainfo.data" style="width: 100%;height: 500px;overflow: auto;">
|
||||
<el-table-column prop="productName" label="商品名称" />
|
||||
<el-table-column prop="num" label="数量" />
|
||||
<el-table-column prop="amount" label="金额" />
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { tbHandoverGet } from '@/api/homes/record.js'
|
||||
import XLSX from 'xlsx';
|
||||
import dayjs from "dayjs";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
timeValue: "",
|
||||
resetQuery: null,
|
||||
orderType: "1",
|
||||
categorys: [],
|
||||
query: {
|
||||
createdAt: [],
|
||||
proName: '',
|
||||
cateId: '',
|
||||
sort: 'id,desc'
|
||||
},
|
||||
tableData: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 10,
|
||||
loading: false,
|
||||
total: 0
|
||||
},
|
||||
tableDatainfo: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 10,
|
||||
loading: false,
|
||||
total: 0
|
||||
},
|
||||
payCountList: "",
|
||||
payCountTotal: 0,
|
||||
dialogshow: false, //弹框显示
|
||||
|
||||
};
|
||||
},
|
||||
filters: {
|
||||
timeFilter(s) {
|
||||
return dayjs(s).format("YYYY-MM-DD");
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.resetQuery = { ...this.query };
|
||||
this.getTableData();
|
||||
},
|
||||
methods: {
|
||||
//携带table id跳转到订单列表页面
|
||||
toTableOrderList(data) {
|
||||
this.$router.push({
|
||||
path: '/order_manage/order_list',
|
||||
query: {
|
||||
tableName: data.tableName
|
||||
}
|
||||
})
|
||||
},
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.timeValue = "";
|
||||
this.query = { ...this.resetQuery };
|
||||
this.page = 0;
|
||||
this.getTableData();
|
||||
},
|
||||
// 分页大小改变
|
||||
sizeChange(e) {
|
||||
this.tableData.size = e;
|
||||
this.getTableData();
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1;
|
||||
this.getTableData();
|
||||
},
|
||||
async getTableData() {
|
||||
this.tableData.loading = true;
|
||||
try {
|
||||
let urlData = null
|
||||
if (this.query.createdAt.length == 0) { // 为什么这么写 因为后端让我有时候传key值有时候不传 为啥不按照框架走后端处理起来太麻烦 前端处理 -- 魏文政 2024.7.30 15:50
|
||||
urlData = `/api/tbHandover?page=${this.tableData.page}&size=${this.tableData.size}&shopId=${localStorage.getItem("shopId")}&sort=${this.query.sort}`
|
||||
} else {
|
||||
urlData = `/api/tbHandover?page=${this.tableData.page}&size=${this.tableData.size}&shopId=${localStorage.getItem("shopId")}&tradeDay=${this.query.createdAt[0] ? this.query.createdAt[0] : ''}&tradeDay=${this.query.createdAt[1] ? this.query.createdAt[1] : ''}&sort=${this.query.sort}`
|
||||
}
|
||||
const res = await tbHandoverGet(urlData);
|
||||
this.tableData.loading = false;
|
||||
this.tableData.data = res.content;
|
||||
console.log(this.tableData.productInfos)
|
||||
this.tableData.total = res.totalElements;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 切换时间
|
||||
timeChange(e) {
|
||||
// const format = ["YYYY-MM-DD 00:00:00", "YYYY-MM-DD 23:59:59"];
|
||||
const format = ["YYYYMMDD", "YYYYMMDD"];
|
||||
switch (e) {
|
||||
case "":
|
||||
// 全部
|
||||
this.query.createdAt = [];
|
||||
break;
|
||||
case "0":
|
||||
// 今天
|
||||
this.query.createdAt = [
|
||||
dayjs().format(format[0]),
|
||||
dayjs().format(format[1])
|
||||
];
|
||||
break;
|
||||
case "-1":
|
||||
// 昨天
|
||||
this.query.createdAt = [
|
||||
dayjs()
|
||||
.add(-1, "d")
|
||||
.format(format[0]),
|
||||
dayjs()
|
||||
.add(-1, "d")
|
||||
.format(format[1])
|
||||
];
|
||||
break;
|
||||
case "-7":
|
||||
// 最近7天
|
||||
this.query.createdAt = [
|
||||
dayjs()
|
||||
.add(-7, "d")
|
||||
.format(format[0]),
|
||||
dayjs().format(format[1])
|
||||
];
|
||||
break;
|
||||
case "-30":
|
||||
// 最近7天
|
||||
this.query.createdAt = [
|
||||
dayjs()
|
||||
.add(-30, "d")
|
||||
.format(format[0]),
|
||||
dayjs().format(format[1])
|
||||
];
|
||||
break;
|
||||
case "week":
|
||||
// 本周
|
||||
this.query.createdAt = [
|
||||
dayjs()
|
||||
.startOf("week")
|
||||
.format(format[0]),
|
||||
dayjs()
|
||||
.endOf("week")
|
||||
.format(format[1])
|
||||
];
|
||||
break;
|
||||
case "month":
|
||||
// 本周
|
||||
this.query.createdAt = [
|
||||
dayjs()
|
||||
.startOf("month")
|
||||
.format(format[0]),
|
||||
dayjs()
|
||||
.endOf("month")
|
||||
.format(format[1])
|
||||
];
|
||||
break;
|
||||
case "custom":
|
||||
// 自定义
|
||||
this.query.createdAt = [];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
// 查看
|
||||
clicksee(e) {
|
||||
this.dialogshow = true
|
||||
// console.log(JSON.parse(e.productInfos))
|
||||
this.tableDatainfo.data = JSON.parse(e.productInfos)
|
||||
},
|
||||
|
||||
clickexport(e) {
|
||||
const arr = JSON.parse(e.productInfos)
|
||||
let data = [
|
||||
['商品名称', '数量', '金额'],
|
||||
]
|
||||
arr.forEach(element => {
|
||||
data.push([element.productName, element.num, element.amount])
|
||||
});
|
||||
|
||||
const ws = XLSX.utils.aoa_to_sheet(data);
|
||||
const wb = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
|
||||
XLSX.writeFile(wb, 'data.xlsx');
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.cursor-pointer {
|
||||
cursor: pointer;
|
||||
color: #1890ff;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.cursor-pointer:hover {
|
||||
opacity: .7;
|
||||
}
|
||||
|
||||
.collect_wrap {
|
||||
display: flex;
|
||||
gap: 14px;
|
||||
|
||||
.item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #f5f5f5;
|
||||
padding: 20px;
|
||||
|
||||
.icon_wrap {
|
||||
$size: 34px;
|
||||
$border: 6px;
|
||||
width: $size;
|
||||
height: $size;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: var(--bg-color);
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
width: $size + $border;
|
||||
height: $size + $border;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background-color: var(--bg-color);
|
||||
opacity: 0.3;
|
||||
}
|
||||
|
||||
.icon {
|
||||
font-size: 16px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.img {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-left: 10px;
|
||||
|
||||
.m {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.t {
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
padding-top: 4px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.refund {
|
||||
color: #ff9731;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.table_order_info {
|
||||
.order_no {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.type {
|
||||
color: #e6a23c;
|
||||
}
|
||||
}
|
||||
|
||||
.goods_info {
|
||||
.row {
|
||||
display: flex;
|
||||
|
||||
&:not(:first-child) {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.cover {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-left: 10px;
|
||||
|
||||
.sku {
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,389 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- <el-tabs v-model="orderType" @tab-click="getTableData">
|
||||
<el-tab-pane label="收款" name="1"></el-tab-pane>
|
||||
<el-tab-pane label="销量" name="2"></el-tab-pane>
|
||||
</el-tabs> -->
|
||||
<div class="head-container">
|
||||
<el-form :model="query" inline label-position="left">
|
||||
<el-radio-group v-model="timeValue" @change="timeChange">
|
||||
<el-radio-button label="">全部</el-radio-button>
|
||||
<el-radio-button label="0">今天</el-radio-button>
|
||||
<el-radio-button label="-1">昨天</el-radio-button>
|
||||
<el-radio-button label="-7">最近7天</el-radio-button>
|
||||
<el-radio-button label="-30">最近30天</el-radio-button>
|
||||
<el-radio-button label="week">本周</el-radio-button>
|
||||
<el-radio-button label="month">本月</el-radio-button>
|
||||
<el-radio-button label="custom">自定义</el-radio-button>
|
||||
</el-radio-group>
|
||||
<el-date-picker v-model="query.createdAt" type="daterange" range-separator="至" start-placeholder="开始日期"
|
||||
end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" value-format="yyyy-MM-dd HH:mm:ss"
|
||||
>
|
||||
</el-date-picker>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
<el-button icon="el-icon-download" v-loading="downloadLoading" @click="downloadHandle">
|
||||
<span v-if="!downloadLoading">导出Excel</span>
|
||||
<span v-else>下载中...</span>
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<!-- <div class="head-container">
|
||||
<div class="collect_wrap">
|
||||
<div class="item" v-for="item in payCountList" :key="item.id">
|
||||
<div class="icon_wrap" style="--bg-color:#C978EE">
|
||||
<i class="icon" :class="item.icon"></i>
|
||||
</div>
|
||||
<div class="info">
|
||||
<div class="m">
|
||||
<template v-if="item.isAmount == 1">¥</template>
|
||||
{{ item.payAmount }}
|
||||
</div>
|
||||
<div class="t">{{ item.payType }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.data" v-loading="tableData.loading" v-if="orderType == 1">
|
||||
|
||||
<el-table-column
|
||||
type="index"
|
||||
width="50">
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="序号" prop="id"></el-table-column> -->
|
||||
<!-- <el-table-column label="区域id" prop="areaId"></el-table-column> -->
|
||||
<el-table-column label="区域名称" prop="areaName"></el-table-column>
|
||||
<!-- <el-table-column label="门店id" prop="shopId"></el-table-column> -->
|
||||
<!-- <el-table-column label="台桌Id" prop="tableId"></el-table-column> -->
|
||||
<el-table-column label="台桌号" prop="tableName"></el-table-column>
|
||||
<el-table-column label="订单数量" prop="orderCount">
|
||||
<template v-slot="scope">
|
||||
<div class="cursor-pointer" @click="toTableOrderList(scope.row)">
|
||||
{{ scope.row.orderCount }}
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="订单金额" prop="orderAmount"></el-table-column>
|
||||
|
||||
</el-table>
|
||||
<!-- <el-table :data="tableData.data" v-loading="tableData.loading" v-if="orderType == 2">
|
||||
<el-table-column label="商品名称" prop="productName"></el-table-column>
|
||||
<el-table-column label="商品分类" prop="cateName"></el-table-column>
|
||||
<el-table-column label="商品描述" prop="productSkuName"></el-table-column>
|
||||
<el-table-column label="销量" prop="salesNum"></el-table-column>
|
||||
<el-table-column label="退单量" prop="refNum"></el-table-column>
|
||||
<el-table-column label="销售金额" prop="salesAmount">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.salesAmount }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="退款金额" prop="refAmount">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.refAmount }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table> -->
|
||||
</div>
|
||||
<!-- <div class="head-container">
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
||||
@current-change="paginationChange" @size-change="sizeChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
</div> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { summaryTable,summaryTableDownload } from '@/api/table'
|
||||
import dayjs from "dayjs";
|
||||
import { downloadFile } from "@/utils/index";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
timeValue: "",
|
||||
resetQuery: null,
|
||||
orderType: "1",
|
||||
categorys: [],
|
||||
query: {
|
||||
createdAt: [],
|
||||
proName: '',
|
||||
cateId: ''
|
||||
},
|
||||
tableData: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 10,
|
||||
loading: false,
|
||||
total: 0
|
||||
},
|
||||
downloadLoading: false,
|
||||
payCountList: "",
|
||||
payCountTotal: 0
|
||||
};
|
||||
},
|
||||
filters: {
|
||||
timeFilter(time) {
|
||||
return dayjs(time).format("YYYY-MM-DD HH:mm:ss");
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.resetQuery = { ...this.query };
|
||||
this.getTableData();
|
||||
},
|
||||
methods: {
|
||||
//携带table id跳转到订单列表页面
|
||||
toTableOrderList(data){
|
||||
console.log(data)
|
||||
this.$router.push({
|
||||
path:'/order_manage/order_list',
|
||||
query:{
|
||||
tableName: data.tableName
|
||||
}
|
||||
})
|
||||
},
|
||||
// 导出Excel
|
||||
async downloadHandle() {
|
||||
try {
|
||||
this.downloadLoading = true;
|
||||
const file = await summaryTableDownload({
|
||||
startTime: this.query.createdAt[0],
|
||||
endTime: this.query.createdAt[1],
|
||||
});
|
||||
downloadFile(file, "数据", "xlsx");
|
||||
this.downloadLoading = false;
|
||||
} catch (error) {
|
||||
this.downloadLoading = false;
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.timeValue = "";
|
||||
this.query = { ...this.resetQuery };
|
||||
this.page = 0;
|
||||
this.getTableData();
|
||||
},
|
||||
// 分页大小改变
|
||||
sizeChange(e) {
|
||||
this.tableData.size = e;
|
||||
this.getTableData();
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1;
|
||||
this.getTableData();
|
||||
},
|
||||
async getTableData() {
|
||||
this.tableData.loading = true;
|
||||
try {
|
||||
const res = await summaryTable({
|
||||
page: this.tableData.page+1,
|
||||
size: this.tableData.size,
|
||||
startTime:this.query.createdAt[0],
|
||||
endTime:this.query.createdAt[1]
|
||||
});
|
||||
this.tableData.loading = false;
|
||||
this.tableData.data = res;
|
||||
this.tableData.total = res.length;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 切换时间
|
||||
timeChange(e) {
|
||||
const format = ["YYYY-MM-DD 00:00:00", "YYYY-MM-DD 23:59:59"];
|
||||
switch (e) {
|
||||
case "":
|
||||
// 全部
|
||||
this.query.createdAt = [];
|
||||
break;
|
||||
case "0":
|
||||
// 今天
|
||||
this.query.createdAt = [
|
||||
dayjs().format(format[0]),
|
||||
dayjs().format(format[1])
|
||||
];
|
||||
break;
|
||||
case "-1":
|
||||
// 昨天
|
||||
this.query.createdAt = [
|
||||
dayjs()
|
||||
.add(-1, "d")
|
||||
.format(format[0]),
|
||||
dayjs()
|
||||
.add(-1, "d")
|
||||
.format(format[1])
|
||||
];
|
||||
break;
|
||||
case "-7":
|
||||
// 最近7天
|
||||
this.query.createdAt = [
|
||||
dayjs()
|
||||
.add(-7, "d")
|
||||
.format(format[0]),
|
||||
dayjs().format(format[1])
|
||||
];
|
||||
break;
|
||||
case "-30":
|
||||
// 最近7天
|
||||
this.query.createdAt = [
|
||||
dayjs()
|
||||
.add(-30, "d")
|
||||
.format(format[0]),
|
||||
dayjs().format(format[1])
|
||||
];
|
||||
break;
|
||||
case "week":
|
||||
// 本周
|
||||
this.query.createdAt = [
|
||||
dayjs()
|
||||
.startOf("week")
|
||||
.format(format[0]),
|
||||
dayjs()
|
||||
.endOf("week")
|
||||
.format(format[1])
|
||||
];
|
||||
break;
|
||||
case "month":
|
||||
// 本周
|
||||
this.query.createdAt = [
|
||||
dayjs()
|
||||
.startOf("month")
|
||||
.format(format[0]),
|
||||
dayjs()
|
||||
.endOf("month")
|
||||
.format(format[1])
|
||||
];
|
||||
break;
|
||||
case "custom":
|
||||
// 自定义
|
||||
this.query.createdAt = [];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.cursor-pointer{
|
||||
cursor: pointer;
|
||||
color: #1890ff;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
.cursor-pointer:hover{
|
||||
opacity: .7;
|
||||
}
|
||||
|
||||
.collect_wrap {
|
||||
display: flex;
|
||||
gap: 14px;
|
||||
|
||||
.item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #f5f5f5;
|
||||
padding: 20px;
|
||||
|
||||
.icon_wrap {
|
||||
$size: 34px;
|
||||
$border: 6px;
|
||||
width: $size;
|
||||
height: $size;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: var(--bg-color);
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
width: $size + $border;
|
||||
height: $size + $border;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background-color: var(--bg-color);
|
||||
opacity: 0.3;
|
||||
}
|
||||
|
||||
.icon {
|
||||
font-size: 16px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.img {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-left: 10px;
|
||||
|
||||
.m {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.t {
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
padding-top: 4px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.refund {
|
||||
color: #ff9731;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.table_order_info {
|
||||
.order_no {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.type {
|
||||
color: #e6a23c;
|
||||
}
|
||||
}
|
||||
|
||||
.goods_info {
|
||||
.row {
|
||||
display: flex;
|
||||
|
||||
&:not(:first-child) {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.cover {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-left: 10px;
|
||||
|
||||
.sku {
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,202 +0,0 @@
|
||||
<!-- 耗材列表的新增耗材盘点 -->
|
||||
<template>
|
||||
<el-dialog title="耗材盘点" :visible.sync="dialogVisible" width="80%" @open="form.note = ''">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-position="left" inline>
|
||||
<el-form-item label="账存数量">
|
||||
<el-input v-model="form.balance" readonly style="width: 180px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="实际数量">
|
||||
<el-input-number v-model="form.stocktakinNum" :min="0" :step="1" step-strictly
|
||||
style="width: 180px;"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="盈亏数量">
|
||||
<el-input v-model="profitNumber" readonly :class="{ lose: profitNumber < 0 }"
|
||||
style="width: 180px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="单价">
|
||||
<el-input v-model="form.price" readonly></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="盈亏金额">
|
||||
<el-input v-model="profitPrice" readonly :class="{ lose: profitNumber < 0 }"
|
||||
style="width: 180px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" style="width: 300px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="onSubmitHandle">确 定</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="head-container">
|
||||
<el-table ref="table" :data="tableData.list" v-loading="tableData.loading" border stripe>
|
||||
<el-table-column label="商品信息" width="150px">
|
||||
<template v-slot="scope">
|
||||
<div class="shop_info">
|
||||
<el-image :src="scope.row.coverImg" style="width: 30px;height: 30px;">
|
||||
<div class="img_error" slot="error">
|
||||
<i class="icon el-icon-document-delete"></i>
|
||||
</div>
|
||||
</el-image>
|
||||
<span>{{ scope.row.conName }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="售价" prop="price">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.price }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="账存数量" prop="stockNumber"></el-table-column>
|
||||
<el-table-column label="盈亏数量" prop="lpNum"></el-table-column>
|
||||
<el-table-column label="盈亏金额" prop="lpAmount">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.lpAmount }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="实际库存" prop="acStockNumber"></el-table-column>
|
||||
<el-table-column label="盘点时间" prop="createTime"></el-table-column>
|
||||
<el-table-column label="盘点备注" prop="remark"></el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-sizes="[5, 10, 30, 50]"
|
||||
:page-size="tableData.size" @current-change="paginationChange" @size-change="sizeChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { formatDecimal } from '@/utils'
|
||||
import { tbConCheck, tbConCheckGet } from '@/api/invoicing'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
loading: false,
|
||||
form: {
|
||||
skuId: '', // sku商品必传
|
||||
productId: '', // 必传
|
||||
stocktakinNum: '', // 必传
|
||||
price: '', // 商品价格 非必传 为空盘点价格为商品价格
|
||||
note: "" // 盘点备注 非必传
|
||||
},
|
||||
rules: {
|
||||
stocktakinNum: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入盘点数量',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
},
|
||||
resetForm: '',
|
||||
searhForm: {
|
||||
name: '',
|
||||
skuId: '',
|
||||
productId: ''
|
||||
},
|
||||
tableData: {
|
||||
page: 0,
|
||||
size: 5,
|
||||
total: 0,
|
||||
loading: false,
|
||||
list: []
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.resetForm = { ...this.form }
|
||||
},
|
||||
computed: {
|
||||
profitNumber() {
|
||||
return this.form.stocktakinNum - this.form.balance
|
||||
},
|
||||
profitPrice() {
|
||||
return formatDecimal(this.profitNumber * this.form.price && 0)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onSubmitHandle() {
|
||||
this.$refs.form.validate(async valid => {
|
||||
if (valid) {
|
||||
try {
|
||||
this.form.lpNum = this.profitNumber
|
||||
this.loading = true
|
||||
let res = await tbConCheck(this.form)
|
||||
this.$emit('success', res)
|
||||
// this.dialogVisible = false
|
||||
this.loading = false
|
||||
this.$notify({
|
||||
title: '注意',
|
||||
message: `添加成功`,
|
||||
type: 'success'
|
||||
});
|
||||
this.getTableData()
|
||||
} catch (error) {
|
||||
this.loading = false
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
show(obj) {
|
||||
this.form = Object.assign(this.form, obj)
|
||||
this.dialogVisible = true
|
||||
this.form.conInfoId = obj.consId
|
||||
this.form.stockNumber = obj.balance
|
||||
|
||||
this.searhForm.skuId = obj.productId
|
||||
this.searhForm.productId = obj.consId
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页大小改变
|
||||
sizeChange(e) {
|
||||
this.tableData.size = e
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1
|
||||
this.getTableData()
|
||||
},
|
||||
// 商品列表
|
||||
async getTableData() {
|
||||
try {
|
||||
this.tableData.loading = true
|
||||
const res = await tbConCheckGet({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
name: this.searhForm.name,
|
||||
skuId: this.searhForm.category,
|
||||
productId: this.searhForm.productId,
|
||||
sort: 'id,desc',
|
||||
})
|
||||
this.tableData.list = res.content
|
||||
this.tableData.total = res.totalElements
|
||||
setTimeout(() => {
|
||||
this.tableData.loading = false
|
||||
}, 500);
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.lose {
|
||||
&::v-deep .el-input__inner {
|
||||
color: rgb(238, 29, 29);
|
||||
}
|
||||
}
|
||||
|
||||
.shop_info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
span {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,205 +0,0 @@
|
||||
<!-- 新增库存盘点 -->
|
||||
<template>
|
||||
<el-dialog title="库存盘点" :visible.sync="dialogVisible" width="80%" @open="form.note = ''">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-position="left" inline>
|
||||
<el-form-item label="账存数量">
|
||||
<el-input v-model="detail.stockNumber" readonly style="width: 180px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="实际数量">
|
||||
<el-input-number v-model="form.stocktakinNum" :min="0" :step="1" step-strictly
|
||||
style="width: 180px;"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="盈亏数量">
|
||||
<el-input v-model="profitNumber" readonly :class="{ lose: profitNumber < 0 }"
|
||||
style="width: 180px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="单价">
|
||||
<el-input v-model="detail.salePrice" readonly></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="盈亏金额">
|
||||
<el-input v-model="profitPrice" readonly :class="{ lose: profitNumber < 0 }"
|
||||
style="width: 180px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.note" placeholder="请输入备注" style="width: 300px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="onSubmitHandle">确 定</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="head-container">
|
||||
<el-table ref="table" :data="tableData.list" v-loading="tableData.loading" border stripe>
|
||||
<el-table-column label="商品信息" width="150px">
|
||||
<template v-slot="scope">
|
||||
<div class="shop_info">
|
||||
<el-image :src="scope.row.coverImg" style="width: 30px;height: 30px;">
|
||||
<div class="img_error" slot="error">
|
||||
<i class="icon el-icon-document-delete"></i>
|
||||
</div>
|
||||
</el-image>
|
||||
<span>{{ scope.row.name }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="售价" prop="price">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.price }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="帐存库存" prop="stock"></el-table-column>
|
||||
<el-table-column label="盈亏数量" prop="phaseNum"></el-table-column>
|
||||
<el-table-column label="盈亏金额" prop="phasePrice">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.phasePrice }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="实际库存" prop="inventoryStock"></el-table-column>
|
||||
<el-table-column label="盘点时间" prop="createTime"></el-table-column>
|
||||
<el-table-column label="盘点备注" prop="note"></el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-sizes="[5, 10, 30, 50]"
|
||||
:page-size="tableData.size" @current-change="paginationChange" @size-change="sizeChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { formatDecimal } from '@/utils'
|
||||
import { tbProductStocktakin, tbProductStocktakinGet } from '@/api/invoicing'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
loading: false,
|
||||
detail: '',
|
||||
form: {
|
||||
skuId: '', // sku商品必传
|
||||
productId: '', // 必传
|
||||
stocktakinNum: '', // 必传
|
||||
price: '', // 商品价格 非必传 为空盘点价格为商品价格
|
||||
note: "" // 盘点备注 非必传
|
||||
},
|
||||
rules: {
|
||||
stocktakinNum: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入盘点数量',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
},
|
||||
resetForm: '',
|
||||
searhForm: {
|
||||
name: '',
|
||||
skuId: '',
|
||||
productId: ''
|
||||
},
|
||||
tableData: {
|
||||
page: 0,
|
||||
size: 5,
|
||||
total: 0,
|
||||
loading: false,
|
||||
list: []
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.resetForm = { ...this.form }
|
||||
},
|
||||
computed: {
|
||||
profitNumber() {
|
||||
return this.form.stocktakinNum - this.detail.stockNumber
|
||||
},
|
||||
profitPrice() {
|
||||
return formatDecimal((this.form.stocktakinNum - this.detail.stockNumber) * this.detail.salePrice)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onSubmitHandle() {
|
||||
this.$refs.form.validate(async valid => {
|
||||
if (valid) {
|
||||
try {
|
||||
this.loading = true
|
||||
let res = await tbProductStocktakin(this.form)
|
||||
this.detail.stockNumber = this.form.stocktakinNum
|
||||
this.$emit('success', res)
|
||||
// this.dialogVisible = false
|
||||
this.loading = false
|
||||
this.$notify({
|
||||
title: '注意',
|
||||
message: `添加成功`,
|
||||
type: 'success'
|
||||
});
|
||||
this.getTableData()
|
||||
} catch (error) {
|
||||
this.loading = false
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
show(obj) {
|
||||
console.log(obj);
|
||||
this.detail = { ...obj }
|
||||
this.dialogVisible = true
|
||||
this.form.skuId = obj.skuId
|
||||
this.form.productId = obj.proId
|
||||
this.form.stocktakinNum = obj.stockNumber
|
||||
|
||||
this.searhForm.skuId = obj.productId
|
||||
this.searhForm.productId = obj.proId
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页大小改变
|
||||
sizeChange(e) {
|
||||
this.tableData.size = e
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1
|
||||
this.getTableData()
|
||||
},
|
||||
// 商品列表
|
||||
async getTableData() {
|
||||
try {
|
||||
this.tableData.loading = true
|
||||
const res = await tbProductStocktakinGet({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
name: this.searhForm.name,
|
||||
skuId: this.searhForm.category,
|
||||
productId: this.searhForm.productId,
|
||||
sort: 'id,desc',
|
||||
})
|
||||
this.tableData.list = res.content
|
||||
this.tableData.total = res.totalElements
|
||||
setTimeout(() => {
|
||||
this.tableData.loading = false
|
||||
}, 500);
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.lose {
|
||||
&::v-deep .el-input__inner {
|
||||
color: rgb(238, 29, 29);
|
||||
}
|
||||
}
|
||||
|
||||
.shop_info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
span {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -10,9 +10,9 @@
|
||||
<el-form-item label="地址">
|
||||
<el-input type="textarea" v-model="form.address" placeholder="请输入地址"></el-input>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="标签">
|
||||
<el-form-item label="标签">
|
||||
<el-input v-model="form.tip" placeholder="请输入标签"></el-input>
|
||||
</el-form-item> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input type="textarea" v-model="form.remark" placeholder="请输入备注"></el-input>
|
||||
</el-form-item>
|
||||
@@ -35,7 +35,7 @@ export default {
|
||||
purveyorName: '',
|
||||
purveyorTelephone: '',
|
||||
address: '',
|
||||
// tip: '',
|
||||
tip: '',
|
||||
remark: '',
|
||||
},
|
||||
rules: {
|
||||
@@ -85,7 +85,7 @@ export default {
|
||||
this.form.purveyorName = ''
|
||||
this.form.purveyorTelephone = ''
|
||||
this.form.address = ''
|
||||
// this.form.tip = ''
|
||||
this.form.tip = ''
|
||||
this.form.remark = ''
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,174 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog width="60%" :visible.sync="dialogVisible" :title="query.conName">
|
||||
<div class="app-container">
|
||||
<!-- <div class="head-container">
|
||||
<el-form :model="query" inline>
|
||||
<el-form-item>
|
||||
<el-input v-model="query.conName" placeholder="耗材信息名称" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div> -->
|
||||
<div class="head-container">
|
||||
<el-table
|
||||
ref="table"
|
||||
:data="clickseetableData.data"
|
||||
v-loading="clickseetableData.loading"
|
||||
row-key="id"
|
||||
height="50vh"
|
||||
>
|
||||
<el-table-column label="耗材名称" prop="conName" />
|
||||
<el-table-column label="变动库存" prop="amount">
|
||||
<template v-slot="scope">
|
||||
<span :class="{ red: scope.row.bizType == '-' }"
|
||||
>{{ scope.row.bizType }}{{ scope.row.amount }}</span
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="现有库存" prop="balance" />
|
||||
<!-- <el-table-column label="业务编码" prop="bizCode" /> -->
|
||||
<el-table-column label="业务说明" prop="bizName" />
|
||||
<el-table-column label="商品名称" prop="productName" />
|
||||
<el-table-column label="订单编号" >
|
||||
<template v-slot="scope">
|
||||
<a class="cursor-pointer" @click="toOrderList(scope.row)">{{ scope.row.orderNo||'' }}</a>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="正负号标识" prop="bizType" /> -->
|
||||
<!-- <el-table-column label="耗材id" prop="consId" /> -->
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
prop="createTime"
|
||||
></el-table-column>
|
||||
<!-- <el-table-column label="更新时间" prop="updateTime">
|
||||
<template v-slot="scope">
|
||||
{{ dayjs(scope.row.createdAt).format('YYYY-MM-DD HH:mm:ss') }}
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-pagination
|
||||
:total="clickseetableData.total"
|
||||
:current-page="clickseetableData.page + 1"
|
||||
:page-size="clickseetableData.size"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@current-change="paginationChangetype"
|
||||
@size-change="
|
||||
(e) => {
|
||||
clickseetableData.size = e;
|
||||
clickseetableData.page = 0;
|
||||
getTableData();
|
||||
}
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
<order-detail ref="orderDetail"></order-detail>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { gettbConsInfoFlow } from "@/api/consumable";
|
||||
import orderDetail from "@/views/order_manage/components/orderDetail";
|
||||
export default {
|
||||
components:{
|
||||
orderDetail
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
query: {
|
||||
conName: "",
|
||||
consId:''
|
||||
},
|
||||
dialogVisible:false,
|
||||
clickseetableData: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 10,
|
||||
loading: false,
|
||||
total: 0,
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
toOrderList(data){
|
||||
console.log(data)
|
||||
// if(data.orderId){
|
||||
// this.$refs.orderDetail.show({id:data.orderId})
|
||||
// }
|
||||
this.$router.push({
|
||||
path:'/order_manage/order_list',
|
||||
query:{
|
||||
orderNo: data.orderNo
|
||||
}
|
||||
})
|
||||
},
|
||||
open(query){
|
||||
this.dialogVisible = true;
|
||||
this.query=query
|
||||
console.log(query)
|
||||
this.getTableData();
|
||||
},
|
||||
close(){
|
||||
this.dialogVisible = false;
|
||||
},
|
||||
lookDetail(row) {
|
||||
console.log(row);
|
||||
},
|
||||
resetHandle() {
|
||||
this.clickseetableData.page = 0;
|
||||
this.clickseetableData.size = 30;
|
||||
this.query.conName = "";
|
||||
this.query.consId = "";
|
||||
this.getTableData();
|
||||
},
|
||||
pageSizeChange(e) {
|
||||
this.clickseetableData.size = e;
|
||||
this.getTableData();
|
||||
},
|
||||
paginationChangetype(e) {
|
||||
this.clickseetableData.page = e - 1;
|
||||
this.getTableData();
|
||||
},
|
||||
// 查看查询耗材流水信息
|
||||
async getTableData() {
|
||||
try {
|
||||
this.clickseetableData.loading = true;
|
||||
const res = await gettbConsInfoFlow({
|
||||
page: this.clickseetableData.page,
|
||||
size: this.clickseetableData.size,
|
||||
...this.query,
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
});
|
||||
this.clickseetableData.loading = false;
|
||||
this.clickseetableData.data = res.content;
|
||||
this.clickseetableData.total = res.totalElements;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.cursor-pointer{
|
||||
cursor: pointer;
|
||||
color: #1890ff;
|
||||
font-size: 12px;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
.cursor-pointer:hover{
|
||||
opacity: .7;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -1,189 +0,0 @@
|
||||
<!-- 耗材列表 -->
|
||||
<template>
|
||||
<el-dialog title="选择耗材" :visible.sync="dialogVisible" @open="resetHandle()">
|
||||
<el-form :model="searchForm" inline>
|
||||
<el-form-item>
|
||||
<el-input v-model="searchForm.conTypeName" placeholder="耗材类型名称" @input="onInput"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-input v-model="searchForm.conCode" placeholder="耗材代码" @input="onInput"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-input v-model="searchForm.conName" placeholder="耗材名称" @input="onInput"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="head-container">
|
||||
<el-table ref="table" :data="tableData.list" v-loading="tableData.loading" @select="firstSelectChange"
|
||||
:row-key="getRowKey" @selection-change="onSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center"></el-table-column>
|
||||
<el-table-column label="耗材名称" prop="conName"></el-table-column>
|
||||
<el-table-column label="价格" prop="price"></el-table-column>
|
||||
<el-table-column label="耗材代码" prop="conCode"></el-table-column>
|
||||
<el-table-column label="耗材类型名称" prop="conTypeName"></el-table-column>
|
||||
<el-table-column label="单位" prop="conUnit"></el-table-column>
|
||||
<el-table-column label="最近入库量" prop="lasterInStock"></el-table-column>
|
||||
<el-table-column label="库存数量" prop="stockNumber">
|
||||
<template v-slot="scope">
|
||||
{{ formatDecimal(scope.row.stockNumber - scope.row.stockConsume, 2, true) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="操作" fixed="right">
|
||||
<template v-slot="scope">
|
||||
<el-button type="primary" size="mini" @click="confirmHandle(scope.row)">选择</el-button>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
</div>
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
||||
@current-change="paginationChange" @size-change="sizeChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="confirmHandle">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { formatDecimal } from '@/utils'
|
||||
import { tbConsInfoGet } from "@/api/invoicing";
|
||||
import _ from 'lodash'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
formatDecimal,
|
||||
dialogVisible: false,
|
||||
searchForm: {
|
||||
conTypeId: '',
|
||||
conTypeName: '',
|
||||
conCode: '',
|
||||
conName: ''
|
||||
},
|
||||
resetSearchForm: '',
|
||||
tableData: {
|
||||
page: 0,
|
||||
size: 10,
|
||||
total: 0,
|
||||
loading: false,
|
||||
list: []
|
||||
},
|
||||
goods: [],
|
||||
stayselection: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.resetSearchForm = { ...this.searchForm }
|
||||
},
|
||||
methods: {
|
||||
onInput: _.debounce(function (event) { //防抖请求
|
||||
this.getTableData()
|
||||
}, 500),
|
||||
onSelectionChange(selection) {
|
||||
this.stayselection = selection
|
||||
},
|
||||
getRowKey(row) {
|
||||
return row.id
|
||||
},
|
||||
firstSelectChange() {
|
||||
// console.log(selection)
|
||||
let selection = this.$refs.table.selection
|
||||
if (selection.length > 1 && this.isselect) {
|
||||
const del_row = selection.shift();
|
||||
this.$refs.table.toggleRowSelection(del_row, false);
|
||||
}
|
||||
},
|
||||
|
||||
// 确定选商品
|
||||
confirmHandle() {
|
||||
// let res = this.$refs.table.selection
|
||||
// let res = this.stayselection
|
||||
// this.$emit('success', res)
|
||||
var uniqueArray = this.stayselection.filter(item1 =>
|
||||
!this.goods.some(item2 => item2.productId == item1.id)
|
||||
);
|
||||
this.$emit('success', uniqueArray)
|
||||
this.close()
|
||||
},
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.searchForm = { ...this.resetSearchForm }
|
||||
this.tableData.page = 0
|
||||
this.tableData.size = 10
|
||||
this.tableData.list = []
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页大小改变
|
||||
sizeChange(e) {
|
||||
this.tableData.size = e
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1
|
||||
this.getTableData()
|
||||
},
|
||||
// 耗材列表
|
||||
async getTableData() {
|
||||
this.tableData.loading = true
|
||||
try {
|
||||
const res = await tbConsInfoGet({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
...this.searchForm
|
||||
})
|
||||
this.tableData.list = res.content
|
||||
this.tableData.total = res.totalElements
|
||||
|
||||
if (this.goods.length) {
|
||||
this.$nextTick(() => {
|
||||
this.selection()
|
||||
})
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.tableData.loading = false
|
||||
}, 500);
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
show(goods) {
|
||||
this.dialogVisible = true
|
||||
if (goods && goods.length) {
|
||||
this.goods = goods
|
||||
} else {
|
||||
this.goods = []
|
||||
}
|
||||
this.resetHandle()
|
||||
this.getTableData()
|
||||
},
|
||||
close() {
|
||||
this.dialogVisible = false
|
||||
},
|
||||
selection() {
|
||||
this.goods.forEach(row => {
|
||||
this.tableData.list.forEach((item, index) => {
|
||||
if (row.id == item.id) {
|
||||
this.$refs.table.toggleRowSelection(this.tableData.list[index]);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.shop_info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
span {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -3,13 +3,10 @@
|
||||
<el-dialog title="详情记录" width="80%" :visible.sync="dialogVisible" @close="dialogVisible = false">
|
||||
<div class="head-container">
|
||||
<el-select v-model="query.type" placeholder="选择类型">
|
||||
<el-option label="供应商入库" value="purveyor"></el-option>
|
||||
<el-option label="供应商退货" value="reject"></el-option>
|
||||
<el-option label="其他入库" value="purchase"></el-option>
|
||||
<el-option label="其他出库" value="other-out"></el-option>
|
||||
<el-option :label="item.label" :value="item.value" v-for="item in typeList" :key="item.id"></el-option>
|
||||
</el-select>
|
||||
<el-date-picker v-model="query.createdAt" type="daterange" range-separator="至" start-placeholder="开始日期"
|
||||
end-placeholder="结束日期" value-format="yyyy-MM-dd">
|
||||
end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss">
|
||||
</el-date-picker>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
@@ -24,35 +21,21 @@
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.list" v-loading="tableData.loading">
|
||||
<el-table-column label="规格名称" prop="specSnap" v-if="goods.specSnap">
|
||||
<el-table-column label="变动数量" prop="stockNumber">
|
||||
<template v-slot="scope">
|
||||
<span v-if="scope.row.specSnap"> {{ scope.row.specSnap }}</span>
|
||||
<span class="num" :class="{ active: scope.row.stockNumber > 0 }">{{ scope.row.stockNumber }} {{
|
||||
scope.row.unitName
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="类型">
|
||||
<template v-slot="scope">
|
||||
<el-tag type="info">{{ scope.row.type }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="原有库存" prop="leftNumber">
|
||||
</el-table-column>
|
||||
<el-table-column label="变动数量" prop="stockNumber">
|
||||
<template v-slot="scope">
|
||||
<span class="num" :class="{ active: scope.row.stockNumber > 0 }">
|
||||
{{ scope.row.stockNumber }} {{ scope.row.unitName }}
|
||||
</span>
|
||||
<el-tag type="info">{{ scope.row.tagName }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="剩余库存">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.leftNumber + scope.row.stockNumber }} {{ scope.row.unitName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="订单号">
|
||||
<template v-slot="scope">
|
||||
<span @click="goUrl(scope.row.orderNo)" style="color: blue;cursor: pointer">
|
||||
{{ scope.row.orderNo }}
|
||||
</span>
|
||||
{{ scope.row.leftNumber - scope.row.stockNumber }} {{ scope.row.unitName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作时间" prop="updatedAt">
|
||||
@@ -69,7 +52,7 @@
|
||||
|
||||
<script>
|
||||
import dayjs from 'dayjs'
|
||||
import { tbProductStockDetail, tbProductStockDetailSum } from '@/api/invoicing'
|
||||
import { dictDetail, tbProductStockDetail, tbProductStockDetailSum } from '@/api/invoicing'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -95,24 +78,21 @@ export default {
|
||||
methods: {
|
||||
async getTableData() {
|
||||
this.tableData.loading = true
|
||||
let arr = []
|
||||
if (this.query.createdAt.length) {
|
||||
arr = [this.query.createdAt[0] + ' 00:00:00', this.query.createdAt[1] + ' 23:59:59']
|
||||
} else {
|
||||
arr = []
|
||||
}
|
||||
try {
|
||||
const res = await tbProductStockDetail({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
sort: this.tableData.sort,
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
productId: this.goods.proId,
|
||||
productId: this.goods.id,
|
||||
type: this.query.type,
|
||||
createdAt: arr
|
||||
createdAt: this.query.createdAt
|
||||
})
|
||||
this.tableData.loading = false
|
||||
this.tableData.list = res.content
|
||||
this.tableData.list = res.content.map(item => {
|
||||
item.tagName = this.typeList.find(val => val.value == item.type).label
|
||||
return item
|
||||
})
|
||||
console.log(this.tableData.list)
|
||||
this.tableData.total = res.totalElements
|
||||
} catch (error) {
|
||||
@@ -124,35 +104,42 @@ export default {
|
||||
this.tableData.page = e - 1
|
||||
this.getTableData()
|
||||
},
|
||||
goUrl(orderNo) {
|
||||
this.$router.push({ path: '/order_manage/order_list', query: { orderNo } })
|
||||
},
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.query.blurry = ''
|
||||
this.tableData.page = 0
|
||||
this.tableData.list = []
|
||||
this.query.type = ''
|
||||
this.query.createdAt = []
|
||||
this.getTableData()
|
||||
},
|
||||
async show(obj) {
|
||||
this.dialogVisible = true
|
||||
this.goods = obj
|
||||
console.log(obj)
|
||||
this.tbProductStockDetailSum()
|
||||
await this.dictDetail()
|
||||
await this.getTableData()
|
||||
},
|
||||
async tbProductStockDetailSum() {
|
||||
try {
|
||||
const { exchange } = await tbProductStockDetailSum({
|
||||
productId: this.goods.proId
|
||||
productId: this.goods.id
|
||||
})
|
||||
this.exchange = exchange
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
async dictDetail() {
|
||||
try {
|
||||
const res = await dictDetail({
|
||||
dictName: 'product_stock_type',
|
||||
page: 0,
|
||||
size: 100
|
||||
})
|
||||
this.typeList = res.content
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,24 +1,14 @@
|
||||
<template>
|
||||
<el-dialog title="详情" width="80%" :visible.sync="dialogVisible" @close="dialogVisible = false">
|
||||
<div class="head-container">
|
||||
<span>【{{ row.type }}】</span>
|
||||
<span>【{{ tableData.detail.type == 'reject' ? '退货出库' : '供应商入库' }}】</span>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.detail.stockSnap" v-loading="tableData.loading" height="400px">
|
||||
<el-table-column :label="`商品名称`" prop="name"></el-table-column>
|
||||
<el-table-column label="规格" prop="specSnap"></el-table-column>
|
||||
<el-table-column label="原库存" prop="stockNumber"></el-table-column>
|
||||
<el-table-column :label="`商品名称${tableData.detail.stockSnap.length}`" prop="name"></el-table-column>
|
||||
<el-table-column label="变动数量" prop="number">
|
||||
<template v-slot="scope">
|
||||
<span v-if="tableData.detail.subType == -1">-</span> {{ scope.row.number }} {{
|
||||
scope.row.unitName
|
||||
}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="现有库存" prop="number">
|
||||
<template v-slot="scope">
|
||||
{{ returnNowHasNumbr(scope.row) }}
|
||||
<!-- {{ scope.row.stockNumber*1 + scope.row.number*1 }} {{ scope.row.unitName }} -->
|
||||
{{ scope.row.number }}{{ scope.row.unitName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -26,20 +16,18 @@
|
||||
<div class="head-container">
|
||||
<div class="row">备注:{{ tableData.detail.remark }}</div>
|
||||
<div class="row">操作人:{{ tableData.detail.operatorSnap.name }}</div>
|
||||
<div class="row">创建时间:{{ dayjs(tableData.detail.createdAt).format('YYYY-MM-DD HH:mm:ss') }}</div>
|
||||
<div class="row">创建时间:{{ tableData.detail.createdAt }}</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import dayjs from 'dayjs'
|
||||
import { formatDecimal } from '@/utils/index.js'
|
||||
import { tbProductStockOperateDetail } from '@/api/invoicing'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dayjs,
|
||||
row: '',
|
||||
dialogVisible: false,
|
||||
tableData: {
|
||||
loading: false,
|
||||
@@ -53,18 +41,9 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
//返回现有库存数量
|
||||
returnNowHasNumbr(row) {
|
||||
const subType = this.tableData.detail.subType || 1
|
||||
if (!row.hasOwnProperty('number')) {
|
||||
return ''
|
||||
}
|
||||
return formatDecimal(parseFloat(row.stockNumber * 1 + row.number * subType + row.unitName), 2, true)
|
||||
},
|
||||
show(row) {
|
||||
show(id) {
|
||||
this.dialogVisible = true
|
||||
this.row = row
|
||||
this.getTableData(row.id)
|
||||
this.getTableData(id)
|
||||
},
|
||||
async getTableData(id) {
|
||||
this.tableData.loading = true
|
||||
@@ -72,7 +51,6 @@ export default {
|
||||
const res = await tbProductStockOperateDetail(id)
|
||||
this.tableData.loading = false
|
||||
this.tableData.detail = res
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
@@ -1,250 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog width="60vw" title="选择商品" :visible.sync="dialogVisible" @open="resetHandle()">
|
||||
<el-form :model="searhForm" inline>
|
||||
<el-form-item>
|
||||
<el-input v-model="searhForm.name" placeholder="商品名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select v-model="searhForm.category" placeholder="商品分类">
|
||||
<el-option :label="item.name" :value="item.id" v-for="item in categoryList"
|
||||
:key="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="head-container">
|
||||
<el-table ref="table" height="70vh" :data="tableData.list"
|
||||
row-key="id" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }" lazy :load="load"
|
||||
@select="firstSelectChange" v-loading="tableData.loading">
|
||||
<!-- <el-table-column type="selection" width="55" align="center"></el-table-column> -->
|
||||
<el-table-column width="30">
|
||||
<template v-slot="scope">
|
||||
<i class="" v-if="scope.row.hasChildren == false"></i>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品信息">
|
||||
<template v-slot="scope">
|
||||
<div class="shop_info">
|
||||
<el-image :src="scope.row.coverImg" class="cover" v-if="scope.row.iskaiguans != 1">
|
||||
<div class="img_error" slot="error">
|
||||
<i class="icon el-icon-document-delete"></i>
|
||||
</div>
|
||||
</el-image>
|
||||
<div class="info">
|
||||
<span>{{ scope.row.name }}</span>
|
||||
<div v-if="scope.row.iskaiguans != 1">
|
||||
<el-tag type="primary">{{ scope.row.typeEnum }}</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格">
|
||||
<template v-slot="scope">
|
||||
<div v-if="scope.row.iskaiguans">
|
||||
{{ scope.row.specSnap }}
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column> <el-table-column label="是否售罄">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.isPauseSale == 1 ? '是' : '否' }}
|
||||
</template>
|
||||
</el-table-column> <el-table-column label="是否分销">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.isDistribute == 1 ? '是' : '否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="售价">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.lowPrice }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="销量/库存">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.realSalesNumber }}/{{ scope.row.stockNumber }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="分类名称" prop="categoryName"></el-table-column>
|
||||
<el-table-column label="绑定耗材" >
|
||||
<template v-slot="scope">
|
||||
<div v-if="scope.row.iskaiguans">
|
||||
<el-button type="text" size="mini" @click="showHaocai">绑定耗材</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
||||
@current-change="paginationChange" @size-change="sizeChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="confirmHandle">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<choose-haocai ref="chooseHaocai"></choose-haocai>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { tbShopCategoryGet, tbProductlist,stocks } from "@/api/invoicing";
|
||||
import chooseHaocai from "../consumable/components/choose_haocai";
|
||||
|
||||
export default {
|
||||
components:{chooseHaocai},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
searhForm: {
|
||||
name: '',
|
||||
category: ''
|
||||
},
|
||||
categoryList: [],
|
||||
tableData: {
|
||||
page: 0,
|
||||
size: 30,
|
||||
total: 0,
|
||||
loading: false,
|
||||
list: []
|
||||
},
|
||||
goods: [],
|
||||
// 是否单选
|
||||
isselect: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
showHaocai(){
|
||||
this.$refs.chooseHaocai.open()
|
||||
},
|
||||
async load(tree, treeNode, resolve) {
|
||||
const res = await stocks({
|
||||
productId: tree.id,
|
||||
})
|
||||
res.forEach(ele => ele.iskaiguans = 1)
|
||||
setTimeout(() => {
|
||||
resolve(res)
|
||||
}, 50);
|
||||
},
|
||||
firstSelectChange() {
|
||||
// console.log(selection)
|
||||
let selection = this.$refs.table.selection
|
||||
if (selection.length > 1 && this.isselect) {
|
||||
const del_row = selection.shift();
|
||||
this.$refs.table.toggleRowSelection(del_row, false);
|
||||
}
|
||||
},
|
||||
// 确定选商品
|
||||
confirmHandle() {
|
||||
let res = this.$refs.table.selection
|
||||
this.$emit('success', res)
|
||||
this.close()
|
||||
},
|
||||
// 是否单选
|
||||
isselectEvent() {
|
||||
this.isselect = true
|
||||
},
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.searhForm.name = ''
|
||||
this.searhForm.category = ''
|
||||
this.tableData.page = 0
|
||||
this.tableData.size = 30
|
||||
this.tableData.list = []
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页大小改变
|
||||
sizeChange(e) {
|
||||
this.tableData.size = e
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1
|
||||
this.getTableData()
|
||||
},
|
||||
// 商品列表
|
||||
async getTableData() {
|
||||
this.tableData.loading = true
|
||||
try {
|
||||
const res = await tbProductlist({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
name: this.searhForm.name,
|
||||
categoryId: this.searhForm.category,
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
sort: 'id',
|
||||
})
|
||||
this.tableData.list = res.content.map(v=>{
|
||||
// const hasChildren=v.typeEnum == '多规格' && v.isDistribute == 0
|
||||
const hasChildren=true
|
||||
return{...v,hasChildren}
|
||||
})
|
||||
this.tableData.total = res.totalElements
|
||||
|
||||
if (this.goods.length) {
|
||||
this.$nextTick(() => {
|
||||
this.selection()
|
||||
})
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.tableData.loading = false
|
||||
}, 500);
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
// 商品分类
|
||||
async tbShopCategoryGet() {
|
||||
try {
|
||||
const res = await tbShopCategoryGet({
|
||||
page: 0,
|
||||
size: 100,
|
||||
sort: 'id',
|
||||
shopId: localStorage.getItem('shopId')
|
||||
})
|
||||
this.categoryList = res.content
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
show(goods) {
|
||||
this.dialogVisible = true
|
||||
if (goods && goods.length) {
|
||||
this.goods = goods
|
||||
} else {
|
||||
this.goods = []
|
||||
}
|
||||
this.resetHandle()
|
||||
this.tbShopCategoryGet()
|
||||
this.getTableData()
|
||||
},
|
||||
close() {
|
||||
this.dialogVisible = false
|
||||
},
|
||||
selection() {
|
||||
this.goods.forEach(row => {
|
||||
this.tableData.list.forEach((item, index) => {
|
||||
if (row.id == item.id) {
|
||||
this.$refs.table.toggleRowSelection(this.tableData.list[index]);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.shop_info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
span {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,221 +0,0 @@
|
||||
<template>
|
||||
<el-dialog title="选择商品" :visible.sync="dialogVisible" @open="resetHandle()">
|
||||
<el-form :model="searhForm" inline>
|
||||
<el-form-item>
|
||||
<el-input v-model="searhForm.name" placeholder="商品名称" @input="onInput"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select v-model="searhForm.category" placeholder="商品分类">
|
||||
<el-option :label="item.name" :value="item.id" v-for="item in categoryList"
|
||||
:key="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="head-container">
|
||||
<el-table ref="table" :data="tableData.list" @select="firstSelectChange" v-loading="tableData.loading"
|
||||
:row-key="getRowKey" @selection-change="onSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column>
|
||||
<el-table-column label="商品信息">
|
||||
<template v-slot="scope">
|
||||
<div class="shop_info">
|
||||
<el-image :src="scope.row.coverImg" style="width: 30px;height: 30px;">
|
||||
<div class="img_error" slot="error">
|
||||
<i class="icon el-icon-document-delete"></i>
|
||||
</div>
|
||||
</el-image>
|
||||
<span>{{ scope.row.name }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.typeEnum }}
|
||||
</template>
|
||||
</el-table-column> <el-table-column label="是否售罄">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.isPauseSale == 1 ? '是' : '否' }}
|
||||
</template>
|
||||
</el-table-column> <el-table-column label="是否分销">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.isDistribute == 1 ? '是' : '否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="售价">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.lowPrice }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="销量/库存">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.realSalesNumber }}/{{ scope.row.stockNumber }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="分类名称" prop="categoryName"></el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
||||
@current-change="paginationChange" @size-change="sizeChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="confirmHandle">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { tbShopCategoryGet, tbProductlist } from "@/api/invoicing";
|
||||
import _ from 'lodash'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
searhForm: {
|
||||
name: '',
|
||||
category: ''
|
||||
},
|
||||
categoryList: [],
|
||||
tableData: {
|
||||
page: 0,
|
||||
size: 10,
|
||||
total: 0,
|
||||
loading: false,
|
||||
list: []
|
||||
},
|
||||
goods: [],
|
||||
// 是否单选
|
||||
isselect: false,
|
||||
stayselection: []//待确认
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onInput: _.debounce(function (event) {//防抖请求
|
||||
this.getTableData()
|
||||
}, 500),
|
||||
onSelectionChange(selection) {
|
||||
this.stayselection = selection
|
||||
},
|
||||
getRowKey(row) {
|
||||
return row.id
|
||||
},
|
||||
firstSelectChange() {
|
||||
let selection = this.$refs.table.selection
|
||||
if (selection.length > 1 && this.isselect) {
|
||||
const del_row = selection.shift();
|
||||
this.$refs.table.toggleRowSelection(del_row, false);
|
||||
}
|
||||
},
|
||||
// 确定选商品
|
||||
confirmHandle() {
|
||||
// let res = this.$refs.table.selection
|
||||
var uniqueArray = this.stayselection.filter(item1 =>
|
||||
!this.goods.some(item2 => item2.productId == item1.id)
|
||||
);
|
||||
this.$emit('success', uniqueArray)
|
||||
this.close()
|
||||
},
|
||||
// 是否单选
|
||||
isselectEvent() {
|
||||
this.isselect = true
|
||||
},
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.searhForm.name = ''
|
||||
this.searhForm.category = ''
|
||||
this.tableData.page = 0
|
||||
this.tableData.size = 10
|
||||
this.tableData.list = []
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页大小改变
|
||||
sizeChange(e) {
|
||||
this.tableData.size = e
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1
|
||||
this.getTableData()
|
||||
},
|
||||
// 商品列表
|
||||
async getTableData() {
|
||||
this.tableData.loading = true
|
||||
try {
|
||||
const res = await tbProductlist({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
name: this.searhForm.name,
|
||||
categoryId: this.searhForm.category,
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
sort: 'id',
|
||||
})
|
||||
this.tableData.list = res.content
|
||||
this.tableData.total = res.totalElements
|
||||
|
||||
if (this.goods.length) {
|
||||
this.$nextTick(() => {
|
||||
this.selection()
|
||||
})
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.tableData.loading = false
|
||||
}, 500);
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
// 商品分类
|
||||
async tbShopCategoryGet() {
|
||||
try {
|
||||
const res = await tbShopCategoryGet({
|
||||
page: 0,
|
||||
size: 100,
|
||||
sort: 'id',
|
||||
shopId: localStorage.getItem('shopId')
|
||||
})
|
||||
this.categoryList = res.content
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
show(goods) {
|
||||
this.dialogVisible = true
|
||||
if (goods && goods.length) {
|
||||
this.goods = goods
|
||||
} else {
|
||||
this.goods = []
|
||||
}
|
||||
this.resetHandle()
|
||||
this.tbShopCategoryGet()
|
||||
this.getTableData()
|
||||
},
|
||||
close() {
|
||||
this.dialogVisible = false
|
||||
},
|
||||
selection() {
|
||||
this.goods.forEach(row => {
|
||||
this.tableData.list.forEach((item, index) => {
|
||||
if (row.id == item.id) {
|
||||
this.$refs.table.toggleRowSelection(this.tableData.list[index]);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.shop_info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
span {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,621 +0,0 @@
|
||||
<!-- eslint-disable no-empty -->
|
||||
<template>
|
||||
<div class="">
|
||||
<el-dialog title="耗材信息" width="60vw" :visible.sync="informationdialogshow" @close="resetHaocaiTable">
|
||||
<div class="head-container flex">
|
||||
<el-input
|
||||
v-model="queryinformation.conTypeId"
|
||||
size="small"
|
||||
clearable
|
||||
placeholder="请输入类型id"
|
||||
style="width: 100%"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="getTableDatainformation"
|
||||
/>
|
||||
<el-input
|
||||
v-model="queryinformation.conTypeName"
|
||||
size="small"
|
||||
clearable
|
||||
placeholder="请输入类型名称"
|
||||
style="width: 100%"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="getTableDatainformation"
|
||||
/>
|
||||
<el-input
|
||||
v-model="queryinformation.conCode"
|
||||
size="small"
|
||||
clearable
|
||||
placeholder="请输入耗材代码"
|
||||
style="width: 100%"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="getTableDatainformation"
|
||||
/>
|
||||
<el-input
|
||||
v-model="queryinformation.conName"
|
||||
size="small"
|
||||
clearable
|
||||
placeholder="请输入耗材名称"
|
||||
style="width: 100%"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="getTableDatainformation"
|
||||
/>
|
||||
<div style="display: flex; justify-content: flex-end;margin-left: 10px">
|
||||
<el-button
|
||||
style="margin-right: 10px"
|
||||
type="primary"
|
||||
@click="getTableDatainformation"
|
||||
>查询</el-button
|
||||
>
|
||||
<el-button @click="resetHandleinformation">重置</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-table
|
||||
ref="haocaiTable"
|
||||
:data="tableDatainformation.data"
|
||||
v-loading="tableDatainformation.loading"
|
||||
@selection-change="haocaiSelectedChange"
|
||||
row-key="id"
|
||||
>
|
||||
<el-table-column
|
||||
type="selection"
|
||||
width="55"
|
||||
align="center"
|
||||
></el-table-column>
|
||||
<el-table-column prop="id" label="ID" width="50px" />
|
||||
<el-table-column label="耗材名称" prop="conName" />
|
||||
<el-table-column label="耗材代码" prop="conCode" />
|
||||
<el-table-column label="类型名称" prop="conTypeName" />
|
||||
<el-table-column label="单位" prop="conUnit" />
|
||||
<el-table-column label="库存数量" prop="stockNumber">
|
||||
<template v-slot="scope">
|
||||
{{ (scope.row.stockNumber - scope.row.stockConsume).toFixed(2) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- <el-table-column label="单位耗材值" prop="surplusStock" /> -->
|
||||
<el-table-column label="" width="200">
|
||||
<template v-slot="scope">
|
||||
<el-button @click="tableDatainformationtable(scope.row)"
|
||||
>确定</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="head-container">
|
||||
<el-pagination
|
||||
:total="tableDatainformation.total"
|
||||
:current-page="tableDatainformation.page + 1"
|
||||
:page-size="tableDatainformation.size"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@current-change="paginationChangeinformation"
|
||||
@size-change="
|
||||
(e) => {
|
||||
tableDatainformation.size = e;
|
||||
tableDatainformation.page = 0;
|
||||
getTableDatainformation();
|
||||
}
|
||||
"
|
||||
/>
|
||||
<div style="display: flex; justify-content: flex-end">
|
||||
<el-button
|
||||
style="margin-right: 20px"
|
||||
@click="haocaiCancel"
|
||||
>取消</el-button
|
||||
>
|
||||
<el-button type="primary" @click="haocaiConfirm">确定</el-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Sortable from "sortablejs";
|
||||
import dayjs from "dayjs";
|
||||
import { upProSort, tbProduct } from "@/api/shop";
|
||||
import {
|
||||
getviewConSku,
|
||||
gettbProductSpec,
|
||||
gettbConsInfo,
|
||||
posttbProskuCons,
|
||||
puttbProskuCon,
|
||||
deletetbProskuCon,
|
||||
} from "@/api/consumable";
|
||||
//缓存耗材选中的数据
|
||||
let haocaiSelectedMap = {};
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dayjs,
|
||||
query: {
|
||||
conName: "",
|
||||
specSnap: "",
|
||||
name: "",
|
||||
status: "",
|
||||
},
|
||||
surplusStocks: "",
|
||||
typeEnums: [
|
||||
{
|
||||
label: "正常",
|
||||
value: "1",
|
||||
},
|
||||
{
|
||||
label: "禁用",
|
||||
value: "0",
|
||||
},
|
||||
],
|
||||
dialogshow: false, //弹框显示
|
||||
dialogtitle: "", //文字显示
|
||||
informationdialogshow: false,
|
||||
informationdialogshowedit: false,
|
||||
tableData: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 30,
|
||||
loading: false,
|
||||
total: 0,
|
||||
},
|
||||
queryinformation: {
|
||||
conTypeId: "",
|
||||
conTypeName: "",
|
||||
conCode: "",
|
||||
conName: "",
|
||||
},
|
||||
tableDatainformation: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 10,
|
||||
loading: false,
|
||||
total: 0,
|
||||
},
|
||||
tableDataskudialogshow: false,
|
||||
querytableDatasku: {
|
||||
specSnap: "",
|
||||
name: "",
|
||||
shopName: "",
|
||||
},
|
||||
tableDatasku: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 30,
|
||||
loading: false,
|
||||
total: 0,
|
||||
},
|
||||
rules: {},
|
||||
// 动态新增选择框-所有数据
|
||||
addSelect: [],
|
||||
// 筛选集合
|
||||
commodityArr: [],
|
||||
// 选择耗材的index
|
||||
ALLisDistribute: null,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getTableDatainformation();
|
||||
},
|
||||
methods: {
|
||||
open(){
|
||||
this.informationdialogshow=true
|
||||
},
|
||||
close(){
|
||||
this.informationdialogshow=false
|
||||
},
|
||||
resetCommodityArr(){
|
||||
this.commodityArr=[]
|
||||
this.$refs.addSelect.resetFields();
|
||||
},
|
||||
resetHaocaiTable(){
|
||||
console.log('close')
|
||||
haocaiSelectedMap={}
|
||||
console.log(haocaiSelectedMap)
|
||||
this.$refs.haocaiTable.clearSelection()
|
||||
},
|
||||
delGoodsHaocai(haocais,haocaiIndex){
|
||||
if(haocais.length===1){
|
||||
return
|
||||
}
|
||||
haocais.splice(haocaiIndex,1)
|
||||
},
|
||||
//初始化耗材表单选中状态
|
||||
initTableSelected(){
|
||||
for(let i in haocaiSelectedMap){
|
||||
const index=this.tableDatainformation.data.findIndex(v=>v.id==i)
|
||||
if(index!=-1&&haocaiSelectedMap[i]){
|
||||
//删除缓存里的id
|
||||
delete haocaiSelectedMap[i]
|
||||
requestAnimationFrame(()=>{
|
||||
this.$refs.haocaiTable.toggleRowSelection(this.tableDatainformation.data[index],haocaiSelectedMap[i])
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
haocaiCancel(){
|
||||
this.informationdialogshow = false
|
||||
},
|
||||
haocaiConfirm(){
|
||||
console.log(haocaiSelectedMap)
|
||||
|
||||
this.$emit('confirm',haocaiSelectedMap)
|
||||
this.informationdialogshow = false;
|
||||
return
|
||||
this.commodityArr.forEach((ele) => {
|
||||
if (ele.id == this.ALLisDistribute.id) {
|
||||
ele.haocais=[]
|
||||
let index=-1;
|
||||
for(let key in haocaiSelectedMap){
|
||||
const item=haocaiSelectedMap[key]
|
||||
console.log(item)
|
||||
index++
|
||||
this.$set(ele.haocais,index,{
|
||||
consInfoId:item.id,
|
||||
conInfoId:item.id,
|
||||
conName:item.conName,
|
||||
skuId:ele.id,
|
||||
shopId:ele.shopId,
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
this.informationdialogshow = false;
|
||||
},
|
||||
haocaiSelectedChange(e) {
|
||||
const arr = e.filter((v) => v);
|
||||
console.log(arr);
|
||||
for(let item of this.tableDatainformation.data){
|
||||
//判断缓存队列是否有这个id
|
||||
const hasCacheIncludes=haocaiSelectedMap.hasOwnProperty(item.id)
|
||||
//判断当前选中队列里是否有这个id
|
||||
const hasSelectedIncludes=arr.find(v=>v.id==item.id)
|
||||
if(hasSelectedIncludes){
|
||||
haocaiSelectedMap[item.id] = hasSelectedIncludes;
|
||||
}
|
||||
if(hasCacheIncludes&&!hasSelectedIncludes){
|
||||
delete haocaiSelectedMap[item.id];
|
||||
|
||||
}
|
||||
}
|
||||
console.log(haocaiSelectedMap);
|
||||
},
|
||||
limitInput(value, name) {
|
||||
this.surplusStocks.surplusStock =
|
||||
("" + value) // 第一步:转成字符串
|
||||
// .replace(/[^\d^\.]+/g, '') // 第二步:把不是数字,不是小数点的过滤掉
|
||||
|
||||
.replace(/^0+(\d)/, "$1") // 第三步:第一位0开头,0后面为数字,则过滤掉,取后面的数字
|
||||
|
||||
.replace(/^\./, "0.") // 第四步:如果输入的第一位为小数点,则替换成 0. 实现自动补全
|
||||
|
||||
.match(/^\d*(\.?\d{0,2})/g)[0] || "";
|
||||
},
|
||||
handleKeyUp(value, index) {
|
||||
console.log(value, index, "体哦傲视1");
|
||||
if (value < 0) {
|
||||
this.commodityArr[index].surplusStock = value * -1;
|
||||
}
|
||||
},
|
||||
selectShop(res) {
|
||||
console.log(res)
|
||||
this.$refs.bindHaocai.open(res)
|
||||
return
|
||||
this.commodityArr = [];
|
||||
const haocais= {conName:'',surplusStock:""};
|
||||
const arr=res.map(v=>{
|
||||
return{...v,haocais:v.skuList.map(sku=>{
|
||||
return{...sku,conName:sku.conName||'',surplusStock:sku.surplusStock||''}
|
||||
})}
|
||||
})
|
||||
this.addSelect = res.map(v=>{
|
||||
return {...v,haocais:[{...haocais}]}
|
||||
})
|
||||
this.commodityArr=arr
|
||||
|
||||
this.clickdialogframe("add");
|
||||
|
||||
return
|
||||
res.forEach((ele, i) => {
|
||||
// isDistribute1为共享库存-商品,0不共享是多规格
|
||||
// 判断是否共享拆分数据到商品和规格集合里
|
||||
|
||||
let sname = ele.name;
|
||||
if (ele.isDistribute == 1) {
|
||||
console.log('单规格')
|
||||
ele.specSnap = ele.name;
|
||||
ele.conName = ele.conName;
|
||||
this.commodityArr.push({...ele,haocais:[{...haocais}]});
|
||||
ele.names = sname;
|
||||
} else {
|
||||
// 规格数据处理
|
||||
console.log('多规格')
|
||||
ele.skuList.forEach((element, indexs) => {
|
||||
if (indexs == 0) {
|
||||
element.names = sname;
|
||||
}
|
||||
element.conInfoId = element.id;
|
||||
element.conName = element.conName;
|
||||
if (element.specSnap == null) {
|
||||
element.specSnap = sname;
|
||||
}
|
||||
this.commodityArr.push({...element,haocais:[{...haocais}]});
|
||||
});
|
||||
}
|
||||
});
|
||||
this.clickdialogframe("add");
|
||||
},
|
||||
// 选择耗材
|
||||
selecthaocai(item) {
|
||||
|
||||
this.ALLisDistribute = item;
|
||||
this.commodityArr.forEach((ele) => {
|
||||
if (ele.id == this.ALLisDistribute.id) {
|
||||
console.log(ele.haocais)
|
||||
ele.haocais.map(v=>{
|
||||
if(v.conInfoId){
|
||||
haocaiSelectedMap[v.conInfoId]=v
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
this.initTableSelected()
|
||||
this.informationdialogshow = true;
|
||||
|
||||
},
|
||||
//表格拖拽
|
||||
tableDrag() {
|
||||
const el = document.querySelector(
|
||||
"#table_drag .el-table__body-wrapper tbody"
|
||||
);
|
||||
new Sortable(el, {
|
||||
animation: 150,
|
||||
onEnd: async (e) => {
|
||||
// console.log('拖拽结束===', e);
|
||||
if (e.oldIndex == e.newIndex) return;
|
||||
let oid = this.tableData.data[e.oldIndex].id;
|
||||
let nid = this.tableData.data[e.newIndex].id;
|
||||
let ids = this.tableData.data.map((item) => item.id);
|
||||
try {
|
||||
await upProSort({
|
||||
strId: oid,
|
||||
endId: nid,
|
||||
ids: ids,
|
||||
});
|
||||
await this.getTableData();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.query.conName = "";
|
||||
this.query.specSnap = "";
|
||||
this.query.name = "";
|
||||
this.query.status = "";
|
||||
this.tableData.page = 0;
|
||||
this.getTableData();
|
||||
},
|
||||
resetHandlesku() {
|
||||
this.querytableDatasku.specSnap = "";
|
||||
this.querytableDatasku.name = "";
|
||||
this.querytableDatasku.shopName = "";
|
||||
this.tableDatasku.page = 0;
|
||||
this.getTableDatasku();
|
||||
},
|
||||
resetHandleinformation() {
|
||||
this.queryinformation.conTypeId = "";
|
||||
this.queryinformation.conTypeName = "";
|
||||
this.queryinformation.conCode = "";
|
||||
this.queryinformation.conName = "";
|
||||
this.tableDatainformation.page = 0;
|
||||
this.getTableDatainformation();
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1;
|
||||
this.getTableData();
|
||||
},
|
||||
// 获取商品列表
|
||||
async getTableData() {
|
||||
this.tableData.loading = true;
|
||||
try {
|
||||
const res = await getviewConSku({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
conName: this.query.conName,
|
||||
specSnap: this.query.specSnap,
|
||||
name: this.query.name,
|
||||
status: this.query.status,
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
});
|
||||
this.tableData.loading = false;
|
||||
this.tableData.data = res.content;
|
||||
this.tableData.total = res.totalElements;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
paginationChangeinformation(e) {
|
||||
this.tableDatainformation.page = e - 1;
|
||||
this.getTableDatainformation();
|
||||
},
|
||||
// 获取信息管理
|
||||
async getTableDatainformation() {
|
||||
this.tableDatainformation.loading = true;
|
||||
try {
|
||||
const res = await gettbConsInfo({
|
||||
page: this.tableDatainformation.page,
|
||||
size: this.tableDatainformation.size,
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
conTypeId: this.queryinformation.conTypeId,
|
||||
conTypeName: this.queryinformation.conTypeName,
|
||||
conCode: this.queryinformation.conCode,
|
||||
conName: this.queryinformation.conName,
|
||||
});
|
||||
this.tableDatainformation.loading = false;
|
||||
this.tableDatainformation.data = res.content;
|
||||
this.tableDatainformation.total = res.totalElements;
|
||||
this.initTableSelected()
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 耗材信息的信息
|
||||
tableDatainformationtable(item) {
|
||||
this.commodityArr.forEach((ele) => {
|
||||
|
||||
if (ele.id == this.ALLisDistribute.id) {
|
||||
console.log(ele.haocais)
|
||||
ele.haocais[0].consInfoId = item.id;
|
||||
ele.haocais[0].conInfoId = item.id;
|
||||
ele.haocais[0].conName = item.conName;
|
||||
ele.haocais[0].skuId = ele.id;
|
||||
ele.haocais[0].shopId = ele.shopId;
|
||||
|
||||
}
|
||||
});
|
||||
this.informationdialogshow = false;
|
||||
},
|
||||
// 获取商品规格
|
||||
async getTableDatasku() {
|
||||
this.tableDatasku.loading = true;
|
||||
try {
|
||||
const res = await tbProduct({
|
||||
page: this.tableDatasku.page,
|
||||
size: this.tableDatasku.size,
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
specSnap: this.querytableDatasku.specSnap,
|
||||
name: this.querytableDatasku.name,
|
||||
sort: "id.desc",
|
||||
shopName: this.querytableDatasku.shopName,
|
||||
});
|
||||
this.tableDatasku.loading = false;
|
||||
this.tableDatasku.data = res.content;
|
||||
this.tableDatasku.total = res.totalElements;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
Changeinformationsku(e) {
|
||||
this.tableDatasku.page = e - 1;
|
||||
this.getTableDatasku();
|
||||
},
|
||||
// 弹框修改值 添加 编辑
|
||||
clickdialogframe(type, item) {
|
||||
if (type == "add") {
|
||||
// 添加
|
||||
this.dialogtitle = "添加";
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addSelect.resetFields();
|
||||
});
|
||||
this.dialogshow = true;
|
||||
} else {
|
||||
this.informationdialogshowedit = true;
|
||||
this.dialogtitle = "编辑";
|
||||
this.surplusStocks = item;
|
||||
}
|
||||
},
|
||||
async submitForm(formName) {
|
||||
if (this.dialogtitle == "编辑") {
|
||||
let { id, surplusStock } = this.surplusStocks;
|
||||
await puttbProskuCon({
|
||||
id,
|
||||
surplusStock,
|
||||
});
|
||||
this.$message({
|
||||
message: "修改成功",
|
||||
type: "success",
|
||||
});
|
||||
this.informationdialogshowedit = false;
|
||||
} else {
|
||||
// isDistribute1为共享库存-商品,0不共享是多规格
|
||||
let isgongx = false;
|
||||
this.commodityArr.forEach((ele) => {
|
||||
ele.haocais.forEach(v=>{
|
||||
if (!v.skuId || !v.surplusStock) {
|
||||
isgongx = true;
|
||||
}
|
||||
})
|
||||
});
|
||||
if (isgongx) {
|
||||
this.$message.error("请选择耗材信息与输入耗材值");
|
||||
isgongx = false;
|
||||
return;
|
||||
}
|
||||
|
||||
this.commodityArr.forEach((ele) => {
|
||||
// ele.skuInfos = ele.skuList;
|
||||
console.log(ele)
|
||||
ele.skuInfos = ele.haocais;
|
||||
ele.productId = ele.id; //商品id
|
||||
});
|
||||
await posttbProskuCons(this.commodityArr);
|
||||
|
||||
// this.addSelect.forEach((ele) => {
|
||||
// // ele.skuInfos = ele.skuList;
|
||||
// console.log(ele)
|
||||
// ele.skuInfos = ele.haocais;
|
||||
// ele.productId = ele.id; //商品id
|
||||
// });
|
||||
// await posttbProskuCons(this.addSelect);
|
||||
this.$message({
|
||||
message: "新增成功",
|
||||
type: "success",
|
||||
});
|
||||
this.ALLisDistribute = null;
|
||||
this.dialogshow = false;
|
||||
}
|
||||
this.$refs[formName].resetFields();
|
||||
this.getTableData();
|
||||
},
|
||||
resetForm(formName) {
|
||||
this.$refs[formName].resetFields();
|
||||
},
|
||||
// 删除商品
|
||||
async delTableHandle(ids) {
|
||||
try {
|
||||
await deletetbProskuCon(ids);
|
||||
this.getTableData();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.flex{
|
||||
display: flex;
|
||||
align-content: center;
|
||||
}
|
||||
.handle {
|
||||
font-size: 18px;
|
||||
color: #999;
|
||||
|
||||
&:hover {
|
||||
cursor: grab;
|
||||
}
|
||||
}
|
||||
|
||||
.shop_info {
|
||||
display: flex;
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
padding-left: 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.tag_wrap {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
}
|
||||
.head-container .filter-item{
|
||||
margin: 0 5px 0 0;;
|
||||
}
|
||||
</style>
|
||||
@@ -1,105 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog width="60%" :visible.sync="dialogVisible" :title="query.conName">
|
||||
<div class="app-container">
|
||||
<!-- <div class="head-container">
|
||||
<el-form :model="query" inline>
|
||||
<el-form-item>
|
||||
<el-input v-model="query.conName" placeholder="耗材信息名称" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div> -->
|
||||
<div class="head-container">
|
||||
<el-table
|
||||
ref="table"
|
||||
:data="clickseetableData.data"
|
||||
v-loading="clickseetableData.loading"
|
||||
row-key="id"
|
||||
height="50vh"
|
||||
>
|
||||
<el-table-column label="耗材名称" prop="conName" />
|
||||
<el-table-column label="变动库存" prop="amount">
|
||||
<template v-slot="scope">
|
||||
<span :class="{ red: scope.row.bizType == '-' }"
|
||||
>{{ scope.row.bizType }}{{ scope.row.amount }}</span
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="现有库存" prop="balance" />
|
||||
<el-table-column label="业务说明" prop="bizName" />
|
||||
<el-table-column label="商品名称" prop="productName" />
|
||||
<el-table-column label="订单编号" >
|
||||
<template v-slot="scope">
|
||||
<a class="cursor-pointer" @click="toOrderList(scope.row)">{{ scope.row.orderNo||'' }}</a>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
prop="createTime"
|
||||
></el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
query: {
|
||||
conName: "",
|
||||
consId:''
|
||||
},
|
||||
dialogVisible:false,
|
||||
clickseetableData: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 10,
|
||||
loading: false,
|
||||
total: 0,
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
open(data){
|
||||
console.log(data)
|
||||
this.dialogVisible = true;
|
||||
this.clickseetableData=data
|
||||
},
|
||||
close(){
|
||||
this.dialogVisible = false;
|
||||
},
|
||||
lookDetail(row) {
|
||||
console.log(row);
|
||||
},
|
||||
resetHandle() {
|
||||
},
|
||||
pageSizeChange(e) {
|
||||
},
|
||||
paginationChangetype(e) {
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.cursor-pointer{
|
||||
cursor: pointer;
|
||||
color: #1890ff;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
.cursor-pointer:hover{
|
||||
opacity: .7;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -1,239 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="head-container">
|
||||
<el-form :model="query" inline>
|
||||
<el-form-item>
|
||||
<el-input v-model="query.conName" placeholder="耗材信息名称" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-table
|
||||
ref="table"
|
||||
:data="clickseetableData.data"
|
||||
v-loading="clickseetableData.loading"
|
||||
row-key="consId"
|
||||
:expand-row-keys="expands"
|
||||
@expand-change="expandChange"
|
||||
height="66vh"
|
||||
>
|
||||
<el-table-column type="expand">
|
||||
<template slot-scope="props">
|
||||
<el-table
|
||||
ref="recodersTable"
|
||||
:data="props.row.recoders" row-key="id" height="66vh">
|
||||
<el-table-column label="耗材名称" prop="conName" />
|
||||
<el-table-column label="变动库存" prop="amount">
|
||||
<template v-slot="scope">
|
||||
<span :class="{ red: scope.row.bizType == '-' }"
|
||||
>{{ scope.row.bizType }}{{ scope.row.amount }}</span
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="现有库存" prop="balance" />
|
||||
<el-table-column label="业务说明" prop="bizName" />
|
||||
<el-table-column label="商品名称" prop="productName">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.productName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
prop="createTime"
|
||||
></el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="head-container">
|
||||
<el-pagination
|
||||
:total="props.row.total"
|
||||
:current-page="props.row.page + 1"
|
||||
:page-size="props.row.size"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@current-change="recodersPageChange($event, props.row)"
|
||||
@size-change="recodersSizeChange($event, props.row)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="耗材名称" prop="conName" />
|
||||
<el-table-column label="变动库存" prop="amount">
|
||||
<template v-slot="scope">
|
||||
<span :class="{ red: scope.row.bizType == '-' }"
|
||||
>{{ scope.row.bizType }}{{ scope.row.amount }}</span
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="现有库存" prop="balance" />
|
||||
<!-- <el-table-column label="业务编码" prop="bizCode" /> -->
|
||||
<el-table-column label="业务说明" prop="bizName" />
|
||||
<el-table-column label="商品名称" prop="productName" />
|
||||
<!-- <el-table-column label="正负号标识" prop="bizType" /> -->
|
||||
<!-- <el-table-column label="耗材id" prop="consId" /> -->
|
||||
<el-table-column label="创建时间" prop="createTime"></el-table-column>
|
||||
<!-- <el-table-column label="更新时间" prop="updateTime">
|
||||
<template v-slot="scope">
|
||||
{{ dayjs(scope.row.createdAt).format('YYYY-MM-DD HH:mm:ss') }}
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-pagination
|
||||
:total="clickseetableData.total"
|
||||
:current-page="clickseetableData.page + 1"
|
||||
:page-size="clickseetableData.size"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@current-change="paginationChangetype"
|
||||
@size-change="pageSizeChange "
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { gettbConsInfoFlow, viewConInfoFlow } from "@/api/consumable";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
expands:[],
|
||||
query: {
|
||||
conName: "",
|
||||
},
|
||||
clickseetableData: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 30,
|
||||
loading: false,
|
||||
total: 0,
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getTableData();
|
||||
},
|
||||
methods: {
|
||||
resetRecodetsTable(){
|
||||
this.expands=[];
|
||||
},
|
||||
recodersPageChange(page,row) {
|
||||
// this.clickseetableData.page = e - 1;
|
||||
row.page=page-1;
|
||||
this.getGroupConInfoFlow(row);
|
||||
},
|
||||
recodersSizeChange(size,row){
|
||||
const index = this.clickseetableData.data.findIndex(
|
||||
(v) => v.consId == row.consId
|
||||
);
|
||||
if(index!=-1){
|
||||
row.size=size;
|
||||
row.page=0;
|
||||
}
|
||||
this.getGroupConInfoFlow(row);
|
||||
},
|
||||
// 获取分组内的耗材具体记录
|
||||
async getGroupConInfoFlow(row) {
|
||||
try {
|
||||
row.loading = true;
|
||||
const res = await gettbConsInfoFlow({
|
||||
page: row.page,
|
||||
size: row.size,
|
||||
consId: row.consId,
|
||||
conName: row.conName,
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
});
|
||||
row.loading = false;
|
||||
const index = this.clickseetableData.data.findIndex(
|
||||
(v) => v.consId == row.consId
|
||||
);
|
||||
if (index != -1) {
|
||||
this.$set(this.clickseetableData.data, index, {
|
||||
...this.clickseetableData.data[index],
|
||||
recoders: res.content,
|
||||
total: res.totalElements,
|
||||
});
|
||||
}
|
||||
// const res = await gettbConsInfoFlow({
|
||||
// page: this.clickseetableData.page,
|
||||
// size: this.clickseetableData.size,
|
||||
// consId: "",
|
||||
// conName: this.query.conName,
|
||||
// shopId: localStorage.getItem("shopId")
|
||||
// });
|
||||
console.log(res);
|
||||
this.clickseetableData.loading = false;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
expandChange(row, expandedRows) {
|
||||
//展开
|
||||
if (expandedRows.length) {
|
||||
this.expands=[];
|
||||
if(row){
|
||||
this.expands.push(row.consId);
|
||||
}
|
||||
this.getGroupConInfoFlow(row);
|
||||
} else {
|
||||
this.expands=[];
|
||||
|
||||
}
|
||||
},
|
||||
resetHandle() {
|
||||
this.clickseetableData.page = 0;
|
||||
this.clickseetableData.size = 30;
|
||||
this.query.conName = "";
|
||||
this.getTableData();
|
||||
this.resetRecodetsTable()
|
||||
|
||||
},
|
||||
pageSizeChange(e) {
|
||||
this.clickseetableData.size = e;
|
||||
this.clickseetableData.page = 0;
|
||||
this.resetRecodetsTable()
|
||||
this.getTableData();
|
||||
},
|
||||
paginationChangetype(e) {
|
||||
this.clickseetableData.page = e - 1;
|
||||
this.resetRecodetsTable()
|
||||
this.getTableData();
|
||||
},
|
||||
// 查看查询耗材流水信息
|
||||
async getTableData() {
|
||||
try {
|
||||
this.clickseetableData.loading = true;
|
||||
const res = await viewConInfoFlow({
|
||||
page: this.clickseetableData.page,
|
||||
size: this.clickseetableData.size,
|
||||
consId: "",
|
||||
conName: this.query.conName,
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
});
|
||||
// const res = await gettbConsInfoFlow({
|
||||
// page: this.clickseetableData.page,
|
||||
// size: this.clickseetableData.size,
|
||||
// consId: "",
|
||||
// conName: this.query.conName,
|
||||
// shopId: localStorage.getItem("shopId")
|
||||
// });
|
||||
console.log(res);
|
||||
this.clickseetableData.loading = false;
|
||||
this.clickseetableData.data = res.content.map((v) => {
|
||||
return { ...v, recoders: [], total: 0,
|
||||
page: 0,
|
||||
size: 30,
|
||||
loading: false
|
||||
};
|
||||
});
|
||||
this.clickseetableData.total = res.totalElements;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -1,203 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="head-container">
|
||||
<el-form :model="query" inline>
|
||||
<el-form-item>
|
||||
<el-input v-model="query.conName" placeholder="耗材信息名称" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-table
|
||||
ref="table"
|
||||
:data="clickseetableData.data"
|
||||
v-loading="clickseetableData.loading"
|
||||
row-key="id"
|
||||
height="66vh"
|
||||
>
|
||||
<el-table-column label="耗材名称" prop="conName" />
|
||||
<el-table-column label="现有库存" >
|
||||
<template v-slot="scope">
|
||||
<span :class="[computedClass(scope.row.balance)]"> {{scope.row.balance }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="耗材消耗" prop="conConsume" align="center" />
|
||||
<el-table-column label="耗材入库" prop="conIn" align="center" />
|
||||
<el-table-column label="耗材出库" prop="conOut" align="center" />
|
||||
<el-table-column label="耗材反还" prop="conReturn" align="center"/>
|
||||
|
||||
<!-- <el-table-column label="业务编码" prop="bizCode" /> -->
|
||||
<!-- <el-table-column label="业务说明" prop="bizName" /> -->
|
||||
<!-- <el-table-column label="商品名称" prop="productName" /> -->
|
||||
<!-- <el-table-column label="正负号标识" prop="bizType" /> -->
|
||||
<!-- <el-table-column label="耗材id" prop="consId" /> -->
|
||||
<!-- <el-table-column label="创建时间" prop="createTime"></el-table-column> -->
|
||||
<el-table-column label="所属商品" width="320" align="center">
|
||||
<template v-slot="scope">
|
||||
<el-button
|
||||
v-for="(item) in scope.row.product"
|
||||
@click="toGoods(item)"
|
||||
:key="item.productId"
|
||||
type="text"
|
||||
>{{item.productName}}</el-button
|
||||
>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template v-slot="scope">
|
||||
<el-button
|
||||
type="text"
|
||||
@click="lookDetail(scope.row)"
|
||||
>查看详情</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="更新时间" prop="updateTime">
|
||||
<template v-slot="scope">
|
||||
{{ dayjs(scope.row.createdAt).format('YYYY-MM-DD HH:mm:ss') }}
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-pagination
|
||||
:total="clickseetableData.total"
|
||||
:current-page="clickseetableData.page + 1"
|
||||
:page-size="clickseetableData.size"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@current-change="paginationChangetype"
|
||||
@size-change="
|
||||
e => {
|
||||
clickseetableData.size = e;
|
||||
clickseetableData.page = 0;
|
||||
getTableData();
|
||||
}
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<cons-record-detail ref="recodeDetail"></cons-record-detail>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { gettbConsInfoFlow,viewConInfoFlow } from "@/api/consumable";
|
||||
import consRecordDetail from "../components/cons_record_detail";
|
||||
|
||||
export default {
|
||||
components:{
|
||||
consRecordDetail
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
query: {
|
||||
conName: ""
|
||||
},
|
||||
clickseetableData: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 30,
|
||||
loading: false,
|
||||
total: 0
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getTableData();
|
||||
},
|
||||
methods: {
|
||||
toGoods(data){
|
||||
this.$router.push({
|
||||
path:'/product/product',
|
||||
query:{
|
||||
productId: data.productId
|
||||
}
|
||||
})
|
||||
},
|
||||
computedClass(num){
|
||||
if(num>0){
|
||||
return 'green'
|
||||
}else{
|
||||
return 'red'
|
||||
}
|
||||
},
|
||||
lookDetail(row){
|
||||
this.$refs.recodeDetail.open({
|
||||
"consId": row.consId,
|
||||
"conName": row.conName
|
||||
})
|
||||
},
|
||||
resetHandle() {
|
||||
this.clickseetableData.page = 0;
|
||||
this.clickseetableData.size = 30;
|
||||
this.query.conName = "";
|
||||
this.getTableData();
|
||||
},
|
||||
pageSizeChange(e) {
|
||||
this.clickseetableData.size = e;
|
||||
this.getTableData();
|
||||
},
|
||||
paginationChangetype(e) {
|
||||
this.clickseetableData.page = e - 1;
|
||||
this.getTableData();
|
||||
},
|
||||
// 查看查询耗材流水信息
|
||||
async getTableData() {
|
||||
try {
|
||||
this.clickseetableData.loading = true;
|
||||
const res = await viewConInfoFlow({
|
||||
page: this.clickseetableData.page,
|
||||
size: this.clickseetableData.size,
|
||||
...this.query,
|
||||
shopId: localStorage.getItem("shopId")
|
||||
});
|
||||
this.clickseetableData.loading = false;
|
||||
this.clickseetableData.data = res.content.map(v=>{
|
||||
const productIds=v.productId?v.productId.split(','):[]
|
||||
return{
|
||||
...v,
|
||||
product:productIds.map((str,index)=>{
|
||||
const startIndex=str.indexOf('_')
|
||||
const productId=str.slice(0,startIndex)
|
||||
const productName=str.slice(startIndex+1,str.length)
|
||||
return {
|
||||
productId,
|
||||
productName:productName+`${(index==productIds.length-1)?'':','}`
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
console.log(this.clickseetableData.data)
|
||||
this.clickseetableData.total = res.totalElements;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.green{
|
||||
color: #13ce66;
|
||||
font-weight: bold;
|
||||
}
|
||||
.red{
|
||||
color: #ff4949;
|
||||
font-weight: bold;
|
||||
|
||||
}
|
||||
::v-deep .el-table .cell{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
::v-deep .el-table th.el-table__cell>.cell{
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
@@ -1,362 +0,0 @@
|
||||
<!-- eslint-disable no-empty -->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="head-container">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="3">
|
||||
<el-input
|
||||
v-model="query.name"
|
||||
size="small"
|
||||
clearable
|
||||
placeholder="请输入耗材单位名称"
|
||||
style="width: 100%"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="getTableData"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<el-input
|
||||
v-model="query.conTypeCode"
|
||||
size="small"
|
||||
clearable
|
||||
placeholder="请输入耗材类型代码"
|
||||
style="width: 100%"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="getTableData"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<el-select
|
||||
v-model="query.status"
|
||||
placeholder="请选择商品规格"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
v-for="item in typeEnums"
|
||||
:key="item.label"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
@click="clickdialogframe('add')"
|
||||
>添加</el-button
|
||||
>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="head-container" id="table_drag">
|
||||
<el-table
|
||||
ref="table"
|
||||
:data="tableData.data"
|
||||
v-loading="tableData.loading"
|
||||
row-key="id"
|
||||
>
|
||||
<el-table-column prop="id" label="ID" width="50px" />
|
||||
<el-table-column label="耗材单位名称" prop="name" />
|
||||
<el-table-column label="耗材单位值" prop="value" />
|
||||
|
||||
<!-- <el-table-column label="是否按照当前单位消耗" prop="isconsume">
|
||||
<template v-slot="scope">
|
||||
<el-switch v-model="scope.row.isConsume" @change="isConsumeChange(scope.row)" />
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="创建时间" prop="createTime">
|
||||
<template v-slot="scope">
|
||||
{{ dayjs(scope.row.createTime).format("YYYY-MM-DD HH:mm:ss") }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="200">
|
||||
<template v-slot="scope">
|
||||
<!-- <el-button type="text" icon="el-icon-rank">排序</el-button> -->
|
||||
<el-button
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="clickdialogframe('edit', scope.row)"
|
||||
>编辑</el-button
|
||||
>
|
||||
<!-- <el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
|
||||
<el-button type="text" icon="el-icon-delete" style="margin-left: 20px !important;"
|
||||
slot="reference">删除</el-button>
|
||||
</el-popconfirm> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-pagination
|
||||
:total="tableData.total"
|
||||
:current-page="tableData.page + 1"
|
||||
:page-size="tableData.size"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@current-change="paginationChange"
|
||||
@size-change="
|
||||
(e) => {
|
||||
tableData.size = e;
|
||||
tableData.page = 0;
|
||||
getTableData();
|
||||
}
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
<el-dialog
|
||||
:title="dialogtitle"
|
||||
:visible.sync="dialogshow"
|
||||
@close="resetRuleForm"
|
||||
>
|
||||
<el-form ref="refruleForm" :model="ruleForm" :rules="rules" value-key="">
|
||||
<el-form-item label="父单位" prop="parentId">
|
||||
<el-select v-model="ruleForm.parentId" placeholder="请选择父单位">
|
||||
<el-option
|
||||
v-for="item in unitLists"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="耗材单位名称" prop="name">
|
||||
<el-input v-model="ruleForm.name" />
|
||||
</el-form-item>
|
||||
<el-form-item label="耗材单位值" prop="value">
|
||||
<el-input v-model="ruleForm.value" type="number" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否按照当前单位消耗" prop="isConsume">
|
||||
<el-switch v-model="ruleForm.isConsume" />
|
||||
</el-form-item>
|
||||
<el-form-item style="display: flex; justify-content: flex-end">
|
||||
<el-button @click="dialogshow = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submitForm('refruleForm')"
|
||||
>确 定</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Sortable from "sortablejs";
|
||||
import dayjs from "dayjs";
|
||||
import settings from "@/settings";
|
||||
import {
|
||||
queryTbConUnitInfo,
|
||||
addtbConUnit,
|
||||
edittbConUnit,
|
||||
} from "@/api/consumable";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
unitLists: [
|
||||
{
|
||||
label: "无",
|
||||
value: null,
|
||||
},
|
||||
],
|
||||
dayjs,
|
||||
query: {
|
||||
name: "",
|
||||
parentId: "",
|
||||
status: "",
|
||||
},
|
||||
categorys: [],
|
||||
typeEnums: [
|
||||
{
|
||||
label: "正常",
|
||||
value: "1",
|
||||
},
|
||||
{
|
||||
label: "禁用",
|
||||
value: "0",
|
||||
},
|
||||
],
|
||||
dialogshow: false, //弹框显示
|
||||
dialogtitle: "", //文字显示
|
||||
tableData: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 30,
|
||||
loading: false,
|
||||
total: 0,
|
||||
},
|
||||
ruleForm: {
|
||||
parentId: "",
|
||||
name: "",
|
||||
value: "",
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
isConsume: false,
|
||||
},
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: "请输入耗材单位名称", trigger: "blur" },
|
||||
],
|
||||
value: [
|
||||
{ required: true, message: "请输入耗材单位值", trigger: "blur" },
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getTableData();
|
||||
this.getAllUnit();
|
||||
this.$nextTick(() => {
|
||||
// this.tableDrag()
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
async isConsumeChange(row){
|
||||
await edittbConUnit({...row,isConsume:row.isConsume?1:0})
|
||||
this.$notify.success("修改成功");
|
||||
},
|
||||
//获取全部单位
|
||||
getAllUnit() {
|
||||
queryTbConUnitInfo({ size: 100, page: 0 }).then((res) => {
|
||||
const arr = res.content.map((item) => {
|
||||
return {
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
};
|
||||
});
|
||||
this.unitLists.push(...arr);
|
||||
});
|
||||
},
|
||||
resetRuleForm() {
|
||||
this.ruleForm.name=''
|
||||
this.ruleForm.value=''
|
||||
this.ruleForm.parentId=''
|
||||
this.ruleForm.isConsume=false
|
||||
this.$refs.refruleForm.resetFields();
|
||||
},
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.query.name = "";
|
||||
this.query.parentId = "";
|
||||
this.query.status = "";
|
||||
this.tableData.page = 0;
|
||||
this.getTableData();
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1;
|
||||
this.getTableData();
|
||||
},
|
||||
// 获取耗材单位列表
|
||||
async getTableData() {
|
||||
this.tableData.loading = true;
|
||||
try {
|
||||
const res = await queryTbConUnitInfo({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
name: this.query.name,
|
||||
status: this.query.status,
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
});
|
||||
this.tableData.loading = false;
|
||||
this.tableData.data = res.content;
|
||||
this.tableData.total = res.totalElements;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 弹框修改值 添加 编辑
|
||||
clickdialogframe(type, item) {
|
||||
// eslint-disable-next-line eqeqeq
|
||||
if (type == "add") {
|
||||
// 添加
|
||||
this.dialogtitle = "添加";
|
||||
this.$nextTick(() => {
|
||||
this.$refs.refruleForm.resetFields();
|
||||
});
|
||||
} else {
|
||||
this.dialogtitle = "编辑";
|
||||
this.ruleForm.id = item.id;
|
||||
this.ruleForm.name = item.name;
|
||||
this.ruleForm.value = item.value;
|
||||
this.ruleForm.isConsume = item.isConsume == 1 ? true : false;
|
||||
}
|
||||
this.dialogshow = true;
|
||||
},
|
||||
submitForm(formName) {
|
||||
this.$refs[formName].validate(async (valid) => {
|
||||
if (valid) {
|
||||
if (this.dialogtitle == "编辑") {
|
||||
await edittbConUnit(this.ruleForm);
|
||||
this.dialogshow = false;
|
||||
this.$notify.success("修改成功");
|
||||
this.getTableData();
|
||||
} else {
|
||||
console.log(this.ruleForm);
|
||||
const { name, value, parentId, isConsume } = this.ruleForm;
|
||||
await addtbConUnit({
|
||||
name,
|
||||
value,
|
||||
parentId,
|
||||
isConsume: isConsume ? "1" : "0",
|
||||
});
|
||||
this.$notify.success("添加成功");
|
||||
}
|
||||
this.dialogshow = false;
|
||||
this.$refs[formName].resetFields();
|
||||
this.getTableData();
|
||||
} else {
|
||||
console.log("error submit!!");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
resetForm(formName) {
|
||||
this.$refs[formName].resetFields();
|
||||
},
|
||||
// 删除商品
|
||||
async delTableHandle(ids) {
|
||||
try {
|
||||
await tbProductDelete(ids);
|
||||
this.getTableData();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.handle {
|
||||
font-size: 18px;
|
||||
color: #999;
|
||||
|
||||
&:hover {
|
||||
cursor: grab;
|
||||
}
|
||||
}
|
||||
|
||||
.shop_info {
|
||||
display: flex;
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
padding-left: 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.tag_wrap {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,895 +0,0 @@
|
||||
<!-- eslint-disable no-empty -->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="head-container">
|
||||
<div class="row_wrap">
|
||||
<div class="row">
|
||||
<!-- <el-input
|
||||
v-model="query.conTypeId"
|
||||
size="small"
|
||||
clearable
|
||||
placeholder="请输入类型id"
|
||||
style="width: 150px"
|
||||
@keyup.enter.native="getTableData"
|
||||
/> -->
|
||||
<div style="width: 150px">
|
||||
<el-select v-model="query.conTypeId" placeholder="请选择耗材分类" style="width: 100%">
|
||||
<el-option :label="item.conTypeName" :value="item.id" v-for="item in consTypeList"
|
||||
:key="item.conTypeId" />
|
||||
</el-select>
|
||||
</div>
|
||||
<el-input v-model="query.conTypeName" size="small" clearable placeholder="请输入类型名称" style="width: 150px"
|
||||
@keyup.enter.native="getTableData" />
|
||||
<el-input v-model="query.conCode" size="small" clearable placeholder="请输入耗材代码" style="width: 150px"
|
||||
@keyup.enter.native="getTableData" />
|
||||
<el-input v-model="query.conName" size="small" clearable placeholder="请输入耗材名称" style="width: 150px"
|
||||
@keyup.enter.native="getTableData" />
|
||||
<div style="width: 150px">
|
||||
<el-select v-model="query.status" placeholder="请选择商品规格" style="width: 100%">
|
||||
<el-option :label="item.label" :value="item.value" v-for="item in typeEnums" :key="item.label" />
|
||||
</el-select>
|
||||
</div>
|
||||
<div style="width: 300px;">
|
||||
<el-select clearable v-model="query.sort" placeholder="排序">
|
||||
<el-option label="按数量排序" value="balance,desc" />
|
||||
</el-select>
|
||||
</div>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
</div>
|
||||
<div class="row">
|
||||
<el-button icon="el-icon-download" :loading="downloadLoading" @click="protHandle">导出耗材</el-button>
|
||||
<el-button icon="el-icon-upload2" :loading="uploadLoading" @click="dialogVisible = true">导入耗材</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-button type="primary" icon="el-icon-plus" @click="clickdialogframe('add')">添加</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="head-container" id="table_drag">
|
||||
<el-table ref="table" :data="tableData.data" v-loading="tableData.loading" row-key="id">
|
||||
<!-- <el-table-column prop="id" label="ID" width="50px" /> -->
|
||||
<el-table-column label="耗材名称" prop="conName" align="center" />
|
||||
<!-- <el-table-column label="耗材代码" prop="conCode" /> -->
|
||||
<el-table-column label="分类名称" prop="conTypeName" align="center" />
|
||||
<el-table-column label="单位" prop="conUnit" align="center" />
|
||||
|
||||
|
||||
<el-table-column label="现有库存" align="center">
|
||||
<template v-slot="scope">
|
||||
<span :class="[computedClass(scope.row.balance)]"> {{ scope.row.balance }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="耗材消耗" prop="conConsume" align="center" />
|
||||
<el-table-column label="耗材入库" prop="conIn" align="center" />
|
||||
<el-table-column label="耗材出库" prop="conOut" align="center" />
|
||||
<el-table-column label="耗材反还" prop="conReturn" align="center" />
|
||||
<el-table-column label="库存开关" prop="conReturn" align="center">
|
||||
<template v-slot="scope">
|
||||
<el-switch v-model="scope.row.isCheck" active-value="1" inactive-value="0"
|
||||
@change="showChange($event, scope.row)"></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- <el-table-column label="业务编码" prop="bizCode" /> -->
|
||||
<!-- <el-table-column label="业务说明" prop="bizName" /> -->
|
||||
<!-- <el-table-column label="商品名称" prop="productName" /> -->
|
||||
<!-- <el-table-column label="正负号标识" prop="bizType" /> -->
|
||||
<!-- <el-table-column label="耗材id" prop="consId" /> -->
|
||||
<!-- <el-table-column label="创建时间" prop="createTime"></el-table-column> -->
|
||||
<!-- <el-table-column label="所属商品" width="320" align="center">
|
||||
<template v-slot="scope">
|
||||
<el-button v-for="(item) in scope.row.product" @click="toGoods(item)" :key="item.productId" type="text">{{
|
||||
item.productName }}</el-button>
|
||||
{{ scope.row.productId }}
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="所属商品" width="320" align="center">
|
||||
<template v-slot="scope">
|
||||
<el-button v-for="(item) in scope.row.product" @click="toGoods(item)" :key="item.productId" type="text">{{
|
||||
item.productName }}</el-button>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="最近入库量" prop="lasterInStock" /> -->
|
||||
<el-table-column label="库存数量" align="center" prop="stockNumber">
|
||||
<template v-slot="scope">
|
||||
{{ (scope.row.balance).toFixed(2) }}
|
||||
<!-- {{ (scope.row.stockNumber - scope.row.stockConsume).toFixed(2) }} -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="预警值" align="center" prop="conWarning" />
|
||||
<!-- <el-table-column label="单位耗材值" prop="surplusStock" /> -->
|
||||
<!-- <el-table-column label="排序" prop="sort" sortable /> -->
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="200">
|
||||
<!-- <template v-slot="scope">
|
||||
{{ dayjs(scope.row.createTime).format("YYYY-MM-DD HH:mm:ss") }}
|
||||
</template> -->
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="更新时间" prop="updateTime" width="200"> -->
|
||||
<!-- <template v-slot="scope">
|
||||
{{ dayjs(scope.row.createdAt).format('YYYY-MM-DD HH:mm:ss') }}
|
||||
</template> -->
|
||||
<!-- </el-table-column> -->
|
||||
<el-table-column label="操作" width="250" fixed="right">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" @click="editorHandle(scope.row)">编辑</el-button>
|
||||
<el-button type="text" @click="clicksee(scope.row)" style="margin-left: 10px !important">耗材记录</el-button>
|
||||
<el-button type="text" size="mini" style="margin-left: 10px !important"
|
||||
@click="$refs.AddConsTakin.show(scope.row)">耗材盘点</el-button>
|
||||
<el-button style="margin-left: 10px !important" type="text" @click="lookDetail(scope.row)">查看详情</el-button>
|
||||
<!-- <el-button type="text" icon="el-icon-rank">排序</el-button> -->
|
||||
<!-- <el-button type="text" @click="clickdialogfadd(scope.row)"
|
||||
style="margin-left: 10px !important;">入库</el-button> -->
|
||||
<!-- <el-button type="text" icon="el-icon-edit" @click="clickdialogframe('edit', scope.row)">编辑</el-button> -->
|
||||
<!-- <el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
|
||||
<el-button type="text" icon="el-icon-delete" style="margin-left: 20px !important;"
|
||||
slot="reference">删除</el-button>
|
||||
</el-popconfirm> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
||||
layout="total, sizes, prev, pager, next, jumper" @current-change="paginationChange" @size-change="(e) => {
|
||||
tableData.size = e;
|
||||
tableData.page = 0;
|
||||
getTableData();
|
||||
}
|
||||
" />
|
||||
</div>
|
||||
<!-- 耗材入库 -->
|
||||
<el-dialog title="耗材入库" :visible.sync="libraryshow">
|
||||
<el-form :inline="true" ref="reflibrary" :model="libraryshowdata" :rules="ruleslibrary" class="demo-form-inline">
|
||||
<el-form-item label="耗材入库数量" prop="stockNumber">
|
||||
<el-input v-model.number="libraryshowdata.stockNumber" type="number" placeholder="请输入单位"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item style="display: flex; justify-content: flex-end">
|
||||
<el-button @click="libraryshow = false">取 消</el-button>
|
||||
<el-button type="primary" @click="clickdialoglibraryshow('reflibrary')">确 定</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
<!-- 修改和增加 -->
|
||||
|
||||
<el-dialog :title="dialogtitle" :visible.sync="dialogshow" width="80%">
|
||||
<template v-if="dialogtitle != '编辑'">
|
||||
<div v-for="(item, index) in ruleForms" :key="index">
|
||||
<el-form :inline="true" :ref="'refruleForm' + index" :model="item" :rules="rules" class="demo-form-inline">
|
||||
<el-form-item label=" ">
|
||||
<i class="el-icon-remove-outline color-danger" @click="ruleFormsReduce(index)"></i>
|
||||
</el-form-item>
|
||||
<el-form-item label="单位" prop="conUnit">
|
||||
<el-input v-model="item.conUnit" placeholder="请输入单位"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="耗材类型" prop="conTypeId">
|
||||
<el-select v-model="item.conTypeId" placeholder="请选择"
|
||||
@change="selectChange($event, 'refruleForm' + index, 'conTypeId')">
|
||||
<el-option v-for="option in consTypeList" :key="option.conTypeId" :label="option.conTypeName"
|
||||
:value="option.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item
|
||||
label="耗材类型"
|
||||
prop="conNames"
|
||||
v-if="dialogtitle == '添加'"
|
||||
>
|
||||
<el-input
|
||||
v-model="ruleForm.conNames"
|
||||
placeholder="请输耗材信息名称"
|
||||
disabled
|
||||
></el-input>
|
||||
</el-form-item>-->
|
||||
<!-- <el-form-item v-if="dialogtitle == '添加'">
|
||||
<el-button type="primary" @click="typedialogshow = true"
|
||||
>去选择</el-button
|
||||
>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="耗材信息名称" prop="conName">
|
||||
<el-input v-model="item.conName" placeholder="请输入耗材信息名称"></el-input>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="耗材信息代码" prop="conCode">
|
||||
<el-input
|
||||
v-model="ruleForm.conCode"
|
||||
placeholder="请输入耗材信息代码"
|
||||
></el-input>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="耗材价格">
|
||||
<el-input v-model="item.price" placeholder="请输入耗材价格"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="预警值">
|
||||
<el-input v-model="item.conWarning" placeholder="请输入耗材预警值"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label=" ">
|
||||
<i class="el-icon-circle-plus-outline color-success" @click="ruleFormsAdd(index)"></i>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="单位耗材值" prop="surplusStock">
|
||||
<el-input v-model="ruleForm.surplusStock" placeholder="请输入单位耗材值"></el-input>
|
||||
</el-form-item> -->
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div style="display: flex; justify-content: flex-end">
|
||||
<el-button @click="dialogshow = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submitForms()">
|
||||
确 定
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<el-form :inline="true" ref="refruleForm" :model="ruleForm" :rules="rules" class="demo-form-inline">
|
||||
<el-form-item label="单位" prop="conUnit">
|
||||
<el-input v-model="ruleForm.conUnit" placeholder="请输入单位"></el-input>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="单位" prop="conUnit" v-if="dialogtitle == '添加'">
|
||||
<el-input v-model="ruleForm.conUnit" placeholder="请输入单位"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="耗材类型" prop="conTypeId" v-if="dialogtitle == '添加'">
|
||||
<el-select v-model="ruleForm.conTypeId" placeholder="请选择">
|
||||
<el-option v-for="item in consTypeList" :key="item.conTypeId" :label="item.conTypeName" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item
|
||||
label="耗材类型"
|
||||
prop="conNames"
|
||||
v-if="dialogtitle == '添加'"
|
||||
>
|
||||
<el-input
|
||||
v-model="ruleForm.conNames"
|
||||
placeholder="请输耗材信息名称"
|
||||
disabled
|
||||
></el-input>
|
||||
</el-form-item>-->
|
||||
<!-- <el-form-item v-if="dialogtitle == '添加'">
|
||||
<el-button type="primary" @click="typedialogshow = true"
|
||||
>去选择</el-button
|
||||
>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="耗材信息名称" prop="conName">
|
||||
<el-input v-model="ruleForm.conName" placeholder="请输入耗材信息名称"></el-input>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="耗材信息代码" prop="conCode">
|
||||
<el-input
|
||||
v-model="ruleForm.conCode"
|
||||
placeholder="请输入耗材信息代码"
|
||||
></el-input>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="耗材价格">
|
||||
<el-input v-model="ruleForm.price" placeholder="请输入耗材价格"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="预警值">
|
||||
<el-input v-model="ruleForm.conWarning" placeholder="请输入耗材预警值"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" v-if="dialogtitle == '编辑'">
|
||||
<el-switch v-model="ruleForm.status" active-value="1" inactive-value="0"></el-switch>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="单位耗材值" prop="surplusStock">
|
||||
<el-input v-model="ruleForm.surplusStock" placeholder="请输入单位耗材值"></el-input>
|
||||
</el-form-item> -->
|
||||
<el-form-item style="display: flex; justify-content: flex-end">
|
||||
<el-button @click="dialogshow = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submitForm('refruleForm')">
|
||||
确 定
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="选择类型" :visible.sync="typedialogshow">
|
||||
<div class="head-container">
|
||||
<el-input v-model="querytypedialogshowquery.conTypeName" size="small" clearable placeholder="请输入耗材类型名称"
|
||||
style="width: 100%" class="filter-item" @keyup.enter.native="getTableDatatype" />
|
||||
<el-input v-model="querytypedialogshowquery.conTypeCode" size="small" clearable placeholder="请输入耗材类型代码"
|
||||
style="width: 100%" class="filter-item" @keyup.enter.native="getTableDatatype" />
|
||||
<el-select v-model="querytypedialogshowquery.status" placeholder="请选择商品规格" style="width: 100%">
|
||||
<el-option :label="item.label" :value="item.value" v-for="item in typeEnums" :key="item.label" />
|
||||
</el-select>
|
||||
<div style="margin-top: 10px">
|
||||
<el-button type="primary" @click="getTableDatatype">查询</el-button>
|
||||
<el-button @click="resetHandletype">重置</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-table ref="table" :data="tableDatatype.data" v-loading="tableDatatype.loading" row-key="id">
|
||||
<el-table-column label="耗材类型名称" prop="conTypeName" />
|
||||
<el-table-column label="耗材类型代码" prop="conTypeCode" />
|
||||
<el-table-column label="店铺ID" prop="shopId" />
|
||||
<el-table-column label="状态" prop="status">
|
||||
<template v-slot="scope">
|
||||
<el-tag type="primary" v-if="scope.row.status == '1'">正常</el-tag>
|
||||
<el-tag type="danger" v-if="scope.row.status == '0'">禁用</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="" width="200">
|
||||
<template v-slot="scope">
|
||||
<el-button @click="tableDatatypetable(scope.row)">确定</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="head-container">
|
||||
<el-pagination :total="tableDatatype.total" :current-page="tableDatatype.page + 1"
|
||||
:page-size="tableDatatype.size" layout="total, sizes, prev, pager, next, jumper"
|
||||
@current-change="paginationChangetype" />
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-dialog title="耗材信息" :visible.sync="clickseetypedialogshow">
|
||||
<div class="head-container">
|
||||
<el-table ref="table" :data="clickseetableData.data" v-loading="clickseetableData.loading" row-key="id"
|
||||
height="450">
|
||||
<el-table-column label="耗材名称" prop="conName" />
|
||||
<el-table-column label="变动库存" prop="amount">
|
||||
<template v-slot="scope">
|
||||
<span :class="{ red: scope.row.bizType == '-' }">{{ scope.row.bizType }}{{ scope.row.amount }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="现有库存" prop="balance" />
|
||||
<!-- <el-table-column label="业务编码" prop="bizCode" /> -->
|
||||
<el-table-column label="业务说明" prop="bizName" />
|
||||
<!-- <el-table-column label="正负号标识" prop="bizType" /> -->
|
||||
<!-- <el-table-column label="耗材id" prop="consId" /> -->
|
||||
<el-table-column label="商品信息" prop="productName"></el-table-column>
|
||||
<el-table-column label="创建时间" prop="createTime"></el-table-column>
|
||||
<!-- <el-table-column label="更新时间" prop="updateTime">
|
||||
<template v-slot="scope">
|
||||
{{ dayjs(scope.row.createdAt).format('YYYY-MM-DD HH:mm:ss') }}
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-pagination :total="clickseetableData.total" :current-page="clickseetableData.page + 1"
|
||||
:page-size="clickseetableData.size" layout="total, sizes, prev, pager, next, jumper"
|
||||
@current-change="paginationChangetype" @size-change="(e) => {
|
||||
clickseetableData.size = e;
|
||||
clickseetableData.page = 0;
|
||||
getConsRecord();
|
||||
}
|
||||
" />
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!-- 耗材盘点 -->
|
||||
<AddConsTakin ref="AddConsTakin" @success="resetHandle" />
|
||||
<!-- 查看详情 -->
|
||||
<cons-record-detail ref="recodeDetail"></cons-record-detail>
|
||||
<!-- 导入耗材 -->
|
||||
<el-dialog title="导入库存" :visible.sync="dialogVisible">
|
||||
<UploadExcel :beforeUpload="excelSuccessUpload" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Sortable from "sortablejs";
|
||||
import dayjs from "dayjs";
|
||||
import settings from "@/settings";
|
||||
|
||||
function returnPromise(index, prosise) {
|
||||
return new Promise((resolve, reject) => {
|
||||
prosise.then(res => {
|
||||
console.log(res);
|
||||
resolve({ sucees: true })
|
||||
}).catch(err => {
|
||||
console.log(err);
|
||||
resolve({ sucees: false })
|
||||
})
|
||||
})
|
||||
}
|
||||
import {
|
||||
gettbConsType,
|
||||
gettbConsInfo,
|
||||
posttbConsInfo,
|
||||
gettbConsInfoFlow,
|
||||
posttbConsInfostockIn,
|
||||
postapitbConsInfo
|
||||
} from "@/api/consumable";
|
||||
import AddConsTakin from "../components/addConsTakin";
|
||||
import { tbConsInfodownload, tbConsInfoinputStock } from '@/api/invoicing'
|
||||
import { downloadFile } from "@/utils";
|
||||
import UploadExcel from '@/components/UploadExcel'
|
||||
import consRecordDetail from "../components/cons_record_detail";
|
||||
|
||||
export default {
|
||||
components: { AddConsTakin, UploadExcel, consRecordDetail },
|
||||
data() {
|
||||
return {
|
||||
dayjs,
|
||||
consTypeList: [],
|
||||
query: {
|
||||
conTypeId: "",
|
||||
conTypeName: "",
|
||||
conCode: "",
|
||||
conName: "",
|
||||
status: ''
|
||||
},
|
||||
resetQuery: '',
|
||||
libraryshow: false, //耗材入库显示
|
||||
libraryshowdata: {
|
||||
id: "",
|
||||
stockNumber: ""
|
||||
},
|
||||
ruleslibrary: {
|
||||
stockNumber: [
|
||||
{ required: true, message: "请输入入库数量", trigger: "blur" }
|
||||
]
|
||||
},
|
||||
categorys: [],
|
||||
typeEnums: [
|
||||
{
|
||||
label: "正常",
|
||||
value: "1"
|
||||
},
|
||||
{
|
||||
label: "禁用",
|
||||
value: "0"
|
||||
}
|
||||
],
|
||||
dialogshow: false, //弹框显示
|
||||
dialogtitle: "", //文字显示
|
||||
typedialogshow: false,
|
||||
tableData: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 30,
|
||||
loading: false,
|
||||
total: 0
|
||||
},
|
||||
querytypedialogshowquery: {
|
||||
conTypeCode: "",
|
||||
conTypeName: "",
|
||||
status: ""
|
||||
},
|
||||
tableDatatype: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 30,
|
||||
loading: false,
|
||||
total: 0
|
||||
},
|
||||
clickseetypedialogshow: false,
|
||||
clickseetableData: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 30,
|
||||
loading: false,
|
||||
total: 0
|
||||
},
|
||||
ruleFormLoading: false,
|
||||
ruleForms: [],
|
||||
ruleForm: {
|
||||
conCode: "",
|
||||
conName: "",
|
||||
conTypeId: "",
|
||||
price: "0",
|
||||
conNames: "",
|
||||
// surplusStock: '',
|
||||
conUnit: "",
|
||||
conWarning: "999",
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
status: ''
|
||||
},
|
||||
rules: {
|
||||
conCode: [
|
||||
{ required: true, message: "请输入耗材信息代码", trigger: "blur" }
|
||||
],
|
||||
conName: [
|
||||
{ required: true, message: "请输入耗材信息名称", trigger: "blur" }
|
||||
],
|
||||
conTypeId: [
|
||||
{ required: true, message: "请选择耗材类型", trigger: "change" }
|
||||
],
|
||||
price: [{ required: true, message: "请输入耗材价格", trigger: "blur" }],
|
||||
conWarning: [
|
||||
{ required: true, message: "请输入耗材预警值", trigger: "blur" }
|
||||
],
|
||||
conTypeId: [
|
||||
{ required: true, message: "请输入耗材类型id", trigger: "blur" }
|
||||
],
|
||||
conUnit: [{ required: true, message: "请输入单位", trigger: "blur" }],
|
||||
conWarning: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入单位",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
},
|
||||
downloadLoading: false,
|
||||
uploadLoading: false,
|
||||
dialogVisible: false,
|
||||
consRecordItem: ''
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.resetQuery = { ...this.query }
|
||||
this.resetRuleForms()
|
||||
this.getTableData();
|
||||
this.getTableDatatype();
|
||||
this.gettbConsType()
|
||||
},
|
||||
methods: {
|
||||
lookDetail(row) {
|
||||
this.$refs.recodeDetail.open({
|
||||
"consId": row.consId,
|
||||
"conName": row.conName
|
||||
})
|
||||
},
|
||||
//解决selectc值改变后未验证问题
|
||||
selectChange($event, ref, type) {
|
||||
this.$refs[ref][0].validateField(type)
|
||||
},
|
||||
//重置添加耗材表单
|
||||
resetRuleForms() {
|
||||
this.ruleForms = [{ ...this.ruleForm }]
|
||||
this.$refs['refruleForm0'] && this.$refs['refruleForm0'][0].resetFields()
|
||||
},
|
||||
//添加耗材弹窗删除
|
||||
ruleFormsReduce(index) {
|
||||
if (this.ruleForms.length > 1) {
|
||||
this.ruleForms.splice(index, 1)
|
||||
} else {
|
||||
this.$message({ type: "error", message: "至少保留一种耗材" });
|
||||
}
|
||||
},
|
||||
toGoods(data) {
|
||||
|
||||
this.$router.push({
|
||||
path: '/product/product',
|
||||
query: {
|
||||
productId: data.productId
|
||||
}
|
||||
})
|
||||
},
|
||||
//添加耗材弹窗增加
|
||||
ruleFormsAdd() {
|
||||
console.log('add')
|
||||
this.ruleForms.push({ ...this.ruleForm })
|
||||
},
|
||||
// 导入耗材
|
||||
async excelSuccessUpload(file) {
|
||||
try {
|
||||
this.uploadLoading = true
|
||||
this.dialogVisible = false
|
||||
await tbConsInfoinputStock(file)
|
||||
this.uploadLoading = false
|
||||
this.$notify.success('导入成功')
|
||||
this.resetHandle()
|
||||
} catch (error) {
|
||||
this.dialogVisible = false
|
||||
this.uploadLoading = false
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
computedClass(num) {
|
||||
if (num > 0) {
|
||||
return 'green'
|
||||
} else {
|
||||
return 'red'
|
||||
}
|
||||
},
|
||||
// 状态切换
|
||||
async showChange(e, row) {
|
||||
await postapitbConsInfo([{
|
||||
id: row.consId,
|
||||
"isCheck": row.isCheck,
|
||||
shopId: localStorage.getItem('shopId')
|
||||
}])
|
||||
this.$message.success('修改成功')
|
||||
},
|
||||
// 耗材导出
|
||||
async protHandle() {
|
||||
try {
|
||||
this.downloadLoading = true;
|
||||
const file = await tbConsInfodownload(this.query)
|
||||
downloadFile(file, "耗材", "xlsx");
|
||||
this.downloadLoading = false;
|
||||
} catch (error) {
|
||||
this.downloadLoading = false;
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 编辑
|
||||
editorHandle(row) {
|
||||
this.dialogtitle = "编辑";
|
||||
for (let key in this.ruleForm) {
|
||||
this.ruleForm[key] = row[key];
|
||||
}
|
||||
console.log(row, '调试1')
|
||||
this.ruleForm.id = row.consId;
|
||||
this.dialogshow = true;
|
||||
},
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.query = { ...this.resetQuery }
|
||||
this.tableData.page = 0;
|
||||
this.getTableData();
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1;
|
||||
this.getTableData();
|
||||
},
|
||||
paginationChangetype(e) {
|
||||
this.clickseetableData.page = e - 1;
|
||||
this.getConsRecord();
|
||||
},
|
||||
// 获取信息
|
||||
async getTableData() {
|
||||
this.tableData.loading = true;
|
||||
try {
|
||||
const res = await gettbConsInfo({
|
||||
...this.query,
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
shopId: localStorage.getItem("shopId")
|
||||
});
|
||||
this.tableData.loading = false;
|
||||
// this.tableData.data = res.content;
|
||||
this.tableData.total = res.totalElements;
|
||||
|
||||
this.tableData.data = res.content.map(v => {
|
||||
const productIds = v.productId ? v.productId.split(',') : []
|
||||
return {
|
||||
...v,
|
||||
product: productIds.map((str, index) => {
|
||||
const startIndex = str.indexOf('_')
|
||||
const productId = str.slice(0, startIndex)
|
||||
const productName = str.slice(startIndex + 1, str.length)
|
||||
return {
|
||||
productId,
|
||||
productName: productName + `${(index == productIds.length - 1) ? '' : ','}`
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 获取类型
|
||||
async gettbConsType() {
|
||||
try {
|
||||
const res = await gettbConsType({
|
||||
page: 0,
|
||||
size: 100,
|
||||
shopId: localStorage.getItem("shopId")
|
||||
})
|
||||
this.consTypeList = res.content
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 获取类型
|
||||
async getTableDatatype() {
|
||||
this.tableDatatype.loading = true;
|
||||
try {
|
||||
const res = await gettbConsType({
|
||||
page: this.tableDatatype.page,
|
||||
size: this.tableDatatype.size,
|
||||
conTypeCode: this.querytypedialogshowquery.conTypeCode,
|
||||
conTypeName: this.querytypedialogshowquery.conTypeName,
|
||||
status: this.querytypedialogshowquery.status,
|
||||
shopId: localStorage.getItem("shopId")
|
||||
});
|
||||
this.tableDatatype.loading = false;
|
||||
this.tableDatatype.data = res.content;
|
||||
this.tableDatatype.total = res.totalElements;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 重置查询
|
||||
resetHandletype() {
|
||||
this.querytypedialogshowquery.conTypeName = "";
|
||||
this.querytypedialogshowquery.conTypeCode = "";
|
||||
this.querytypedialogshowquery.status = "";
|
||||
this.tableData.page = 0;
|
||||
this.getTableDatatype();
|
||||
},
|
||||
// 选择的类型
|
||||
tableDatatypetable(item) {
|
||||
// this.ruleForm.conCode = item.conTypeCode
|
||||
this.ruleForm.conNames = item.conTypeName;
|
||||
this.ruleForm.conTypeId = item.id;
|
||||
this.typedialogshow = false;
|
||||
},
|
||||
async clickdialogfadd(item) {
|
||||
this.libraryshow = true;
|
||||
this.libraryshowdata.id = item.id;
|
||||
},
|
||||
async clickdialoglibraryshow(formName) {
|
||||
this.$refs[formName].validate(async valid => {
|
||||
if (valid) {
|
||||
await posttbConsInfostockIn({
|
||||
id: this.libraryshowdata.id,
|
||||
stockNumber: this.libraryshowdata.stockNumber
|
||||
});
|
||||
this.libraryshow = false;
|
||||
this.$refs[formName].resetFields();
|
||||
this.getTableData();
|
||||
} else {
|
||||
console.log("error submit!!");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
// 弹框修改值 添加 编辑
|
||||
clickdialogframe(type, item) {
|
||||
if (type == "add") {
|
||||
// 添加
|
||||
this.dialogtitle = "添加";
|
||||
this.gettbConsType()
|
||||
this.$nextTick(() => {
|
||||
// this.$refs.refruleForm.resetFields();
|
||||
this.resetRuleForms()
|
||||
});
|
||||
} else {
|
||||
this.dialogtitle = "编辑";
|
||||
this.ruleForm.id = item.consId;
|
||||
this.ruleForm.conTypeId = item.conTypeId;
|
||||
this.ruleForm.conCode = item.conCode;
|
||||
this.ruleForm.conName = item.conName;
|
||||
// this.ruleForm.surplusStock = item.surplusStock
|
||||
this.ruleForm.conWarning = item.conWarning;
|
||||
this.ruleForm.conUnit = item.conUnit;
|
||||
}
|
||||
this.dialogshow = true;
|
||||
},
|
||||
//添加
|
||||
async submitForms() {
|
||||
let isAllPassForm = 0
|
||||
for (let i in this.ruleForms) {
|
||||
const res = await returnPromise(i, this.$refs['refruleForm' + i][0].validate())
|
||||
console.log(res)
|
||||
isAllPassForm += res.sucees ? 1 : 0
|
||||
}
|
||||
//判断验证是否通过
|
||||
if (isAllPassForm === this.ruleForms.length) {
|
||||
await posttbConsInfo(this.ruleForms)
|
||||
this.$message({ type: "success", message: "添加成功" });
|
||||
|
||||
// for(let i of this.ruleForms){
|
||||
// const res=await posttbConsInfo(i)
|
||||
// this.$message({ type: "success", message: "添加成功" });
|
||||
// }
|
||||
this.dialogshow = false;
|
||||
this.resetRuleForms()
|
||||
this.ruleFormLoading = false;
|
||||
this.getTableData();
|
||||
}
|
||||
},
|
||||
//编辑
|
||||
submitForm(formName) {
|
||||
|
||||
this.$refs[formName].validate(async valid => {
|
||||
if (valid) {
|
||||
this.ruleFormLoading = true;
|
||||
if (this.dialogtitle == "编辑") {
|
||||
console.log(this.ruleForm, '调试 ')
|
||||
await postapitbConsInfo([this.ruleForm]);
|
||||
this.$message({ type: "success", message: "编辑成功" });
|
||||
this.dialogshow = false;
|
||||
} else {
|
||||
// //添加
|
||||
// console.log(this.ruleForm, '调试')
|
||||
// for(let i of this.ruleForms){
|
||||
// console.log(i)
|
||||
// await posttbConsInfo({
|
||||
// ...i
|
||||
// });
|
||||
// this.$message({ type: "success", message: "添加成功" });
|
||||
|
||||
// }
|
||||
|
||||
}
|
||||
this.dialogshow = false;
|
||||
this.$refs[formName].resetFields();
|
||||
this.ruleFormLoading = false;
|
||||
this.getTableData();
|
||||
} else {
|
||||
console.log("error submit!!");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
resetForm(formName) {
|
||||
this.$refs[formName].resetFields();
|
||||
},
|
||||
// 删除商品
|
||||
async delTableHandle(ids) {
|
||||
try {
|
||||
await tbProductDelete(ids);
|
||||
this.getTableData();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 显示耗材记录
|
||||
async clicksee(item) {
|
||||
this.consRecordItem = item
|
||||
this.clickseetypedialogshow = true;
|
||||
this.getConsRecord()
|
||||
},
|
||||
// 获取耗材记录
|
||||
async getConsRecord() {
|
||||
try {
|
||||
this.clickseetableData.loading = true;
|
||||
const res = await gettbConsInfoFlow({
|
||||
page: this.clickseetableData.page,
|
||||
size: this.clickseetableData.size,
|
||||
consId: this.consRecordItem.id,
|
||||
conName: this.consRecordItem.conName,
|
||||
shopId: localStorage.getItem("shopId")
|
||||
});
|
||||
this.clickseetableData.loading = false;
|
||||
this.clickseetableData.data = res.content;
|
||||
this.clickseetableData.total = res.totalElements;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.color-success {
|
||||
color: #67c23a;
|
||||
cursor: pointer;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.color-danger {
|
||||
color: #f56c6c;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.row_wrap {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.handle {
|
||||
font-size: 18px;
|
||||
color: #999;
|
||||
|
||||
&:hover {
|
||||
cursor: grab;
|
||||
}
|
||||
}
|
||||
|
||||
.shop_info {
|
||||
display: flex;
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
padding-left: 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.tag_wrap {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.red {
|
||||
color: rgb(219, 32, 32);
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,304 +0,0 @@
|
||||
<!-- eslint-disable no-empty -->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="head-container">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="3">
|
||||
<el-input v-model="query.conTypeName" size="small" clearable placeholder="请输入耗材类型名称" style="width: 100%;"
|
||||
class="filter-item" @keyup.enter.native="getTableData" />
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<el-input v-model="query.conTypeCode" size="small" clearable placeholder="请输入耗材类型代码" style="width: 100%;"
|
||||
class="filter-item" @keyup.enter.native="getTableData" />
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<el-select v-model="query.status" placeholder="请选择商品规格" style="width: 100%;">
|
||||
<el-option :label="item.label" :value="item.value" v-for="item in typeEnums" :key="item.label" />
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-button type="primary" icon="el-icon-plus" @click="clickdialogframe('add')">添加</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="head-container" id="table_drag">
|
||||
<el-table ref="table" :data="tableData.data" v-loading="tableData.loading" row-key="id">
|
||||
<el-table-column prop="id" label="ID" width="50px" />
|
||||
<el-table-column label="耗材类型名称" prop="conTypeName" />
|
||||
<el-table-column label="耗材类型代码" prop="conTypeCode" />
|
||||
<el-table-column label="创建时间" prop="createTime">
|
||||
<template v-slot="scope">
|
||||
{{ dayjs(scope.row.createTime).format('YYYY-MM-DD HH:mm:ss') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="店铺ID" prop="shopId">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.shopId }}
|
||||
<!-- <el-link type="primary" @click="$router.push({ name: 'information' })">{{ scope.row.shopId }}</el-link> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" prop="status">
|
||||
<template v-slot="scope">
|
||||
<el-tag type="primary" v-if="scope.row.status == '1'">正常</el-tag>
|
||||
<el-tag type="danger" v-if="scope.row.status == '0'">禁用</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="排序" prop="sort" sortable /> -->
|
||||
<el-table-column label="更新时间" prop="updateTime">
|
||||
<template v-slot="scope">
|
||||
{{ dayjs(scope.row.createdAt).format('YYYY-MM-DD HH:mm:ss') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="200">
|
||||
<template v-slot="scope">
|
||||
<!-- <el-button type="text" icon="el-icon-rank">排序</el-button> -->
|
||||
<el-button type="text" icon="el-icon-edit" @click="clickdialogframe('edit', scope.row)">编辑</el-button>
|
||||
<!-- <el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
|
||||
<el-button type="text" icon="el-icon-delete" style="margin-left: 20px !important;"
|
||||
slot="reference">删除</el-button>
|
||||
</el-popconfirm> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
||||
layout="total, sizes, prev, pager, next, jumper" @current-change="paginationChange"
|
||||
@size-change="e => { tableData.size = e; tableData.page = 0; getTableData() }" />
|
||||
</div>
|
||||
<el-dialog :title="dialogtitle" :visible.sync="dialogshow">
|
||||
<el-form ref="refruleForm" :model="ruleForm" :rules="rules">
|
||||
<el-form-item label="耗材类型名称" prop="conTypeName">
|
||||
<el-input v-model="ruleForm.conTypeName" @input="trimInput($event,'conTypeName')"/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="耗材类型代码" prop="conTypeCode">
|
||||
<el-input v-model="ruleForm.conTypeCode" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="是否禁用" prop="status">
|
||||
<el-switch v-model="ruleForm.status" />
|
||||
</el-form-item>
|
||||
<el-form-item style="display: flex;justify-content: flex-end;">
|
||||
<el-button @click="dialogshow = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submitForm('refruleForm')">确 定</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Sortable from 'sortablejs'
|
||||
import dayjs from 'dayjs'
|
||||
import settings from '@/settings'
|
||||
import { upProSort } from '@/api/shop'
|
||||
import { gettbConsType, posttbConsType, puttbConsType } from '@/api/consumable'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dayjs,
|
||||
query: {
|
||||
conTypeCode: '',
|
||||
conTypeName: '',
|
||||
status: ''
|
||||
},
|
||||
categorys: [],
|
||||
typeEnums: [{
|
||||
label: '正常',
|
||||
value: '1'
|
||||
}, {
|
||||
label: '禁用',
|
||||
value: '0'
|
||||
}],
|
||||
dialogshow: false, //弹框显示
|
||||
dialogtitle: '', //文字显示
|
||||
tableData: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 30,
|
||||
loading: false,
|
||||
total: 0
|
||||
},
|
||||
ruleForm: {
|
||||
conTypeCode: '',
|
||||
conTypeName: '',
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
status: false
|
||||
},
|
||||
rules: {
|
||||
conTypeName: [
|
||||
{ required: true, message: '请输入耗材类型名称', trigger: 'blur' }
|
||||
],
|
||||
conTypeCode: [
|
||||
{ required: true, message: '请输入耗材类型代码', trigger: 'blur' }
|
||||
],
|
||||
status: [
|
||||
{ required: true, message: '选择状态', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getTableData()
|
||||
this.$nextTick(() => {
|
||||
// this.tableDrag()
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
trimInput(val,key){
|
||||
console.log(val)
|
||||
this.ruleForm[key] = val.replace(/\s+/g, '')
|
||||
},
|
||||
//表格拖拽
|
||||
tableDrag() {
|
||||
const el = document.querySelector('#table_drag .el-table__body-wrapper tbody')
|
||||
new Sortable(el, {
|
||||
animation: 150,
|
||||
onEnd: async e => {
|
||||
// console.log('拖拽结束===', e);
|
||||
if (e.oldIndex == e.newIndex) return
|
||||
let oid = this.tableData.data[e.oldIndex].id
|
||||
let nid = this.tableData.data[e.newIndex].id
|
||||
let ids = this.tableData.data.map(item => item.id)
|
||||
try {
|
||||
await upProSort({
|
||||
strId: oid,
|
||||
endId: nid,
|
||||
ids: ids
|
||||
})
|
||||
await this.getTableData()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.query.conTypeCode = ''
|
||||
this.query.conTypeName = ''
|
||||
this.query.status = ''
|
||||
this.tableData.page = 0
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1
|
||||
this.getTableData()
|
||||
},
|
||||
// 获取商品列表
|
||||
async getTableData() {
|
||||
this.tableData.loading = true
|
||||
try {
|
||||
const res = await gettbConsType({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
conTypeCode: this.query.conTypeCode,
|
||||
conTypeName: this.query.conTypeName,
|
||||
status: this.query.status,
|
||||
shopId: localStorage.getItem('shopId')
|
||||
})
|
||||
this.tableData.loading = false
|
||||
this.tableData.data = res.content
|
||||
this.tableData.total = res.totalElements
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
// 弹框修改值 添加 编辑
|
||||
clickdialogframe(type, item) {
|
||||
// eslint-disable-next-line eqeqeq
|
||||
if (type == 'add') { // 添加
|
||||
this.dialogtitle = '添加'
|
||||
this.$nextTick(() => {
|
||||
this.$refs.refruleForm.resetFields()
|
||||
})
|
||||
} else {
|
||||
this.dialogtitle = '编辑'
|
||||
this.ruleForm.id = item.id
|
||||
this.ruleForm.conTypeCode = item.conTypeCode
|
||||
this.ruleForm.conTypeName = item.conTypeName
|
||||
this.ruleForm.status = item.status == 0 ? true : false
|
||||
}
|
||||
this.dialogshow = true
|
||||
},
|
||||
submitForm(formName) {
|
||||
this.$refs[formName].validate(async (valid) => {
|
||||
if (valid) {
|
||||
if (this.dialogtitle == '编辑') {
|
||||
await puttbConsType({
|
||||
id: this.ruleForm.id,
|
||||
conTypeCode: this.ruleForm.conTypeCode,
|
||||
conTypeName: this.ruleForm.conTypeName,
|
||||
shopId: this.ruleForm.shopId,
|
||||
status: this.ruleForm.status ? '0' : '1'
|
||||
})
|
||||
this.dialogshow = false
|
||||
|
||||
this.getTableData()
|
||||
} else {
|
||||
await posttbConsType({
|
||||
// conTypeCode: this.ruleForm.conTypeCode,
|
||||
conTypeName: this.ruleForm.conTypeName,
|
||||
shopId: this.ruleForm.shopId,
|
||||
status: this.ruleForm.status ? '0' : '1'
|
||||
})
|
||||
}
|
||||
this.dialogshow = false
|
||||
this.$refs[formName].resetFields()
|
||||
this.getTableData()
|
||||
} else {
|
||||
console.log('error submit!!')
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
resetForm(formName) {
|
||||
this.$refs[formName].resetFields()
|
||||
},
|
||||
// 删除商品
|
||||
async delTableHandle(ids) {
|
||||
try {
|
||||
await tbProductDelete(ids)
|
||||
this.getTableData()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.handle {
|
||||
font-size: 18px;
|
||||
color: #999;
|
||||
|
||||
&:hover {
|
||||
cursor: grab;
|
||||
}
|
||||
}
|
||||
|
||||
.shop_info {
|
||||
display: flex;
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
padding-left: 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.tag_wrap {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,175 +1,75 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="head-container">
|
||||
<div class="row_wrap">
|
||||
<div class="row">
|
||||
<el-input v-model="query.name" size="small" clearable placeholder="商品名称"
|
||||
@keyup.enter.native="getTableData" />
|
||||
<!-- <el-input v-model="query.num" placeholder="库存数量:少于多少xx" /> -->
|
||||
<div style="width: 300px;">
|
||||
<el-select v-model="query.categoryId" placeholder="商品分类" style="width: 100%;">
|
||||
<el-option :label="item.name" :value="item.id" v-for="item in categorys" :key="item.id" />
|
||||
</el-select>
|
||||
</div>
|
||||
<div style="width: 300px;">
|
||||
<el-select v-model="query.isStock" placeholder="库存开关" style="width: 100%;">
|
||||
<el-option label="开" :value="1">开</el-option>
|
||||
<el-option label="关" :value="0">关</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div style="width: 300px;">
|
||||
<el-select clearable v-model="query.sort" placeholder="排序">
|
||||
<el-option label="按数量排序" value="1" />
|
||||
</el-select>
|
||||
</div>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="6">
|
||||
<el-input v-model="query.name" size="small" clearable placeholder="商品名称" style="width: 100%;"
|
||||
class="filter-item" @keyup.enter.native="getTableData" />
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
<el-button @click="Uppop()">库存预警:{{ warnLine }}</el-button>
|
||||
</div>
|
||||
<div class="row">
|
||||
<el-button icon="el-icon-download" :loading="downloadLoading" @click="protHandle">导出库存</el-button>
|
||||
<el-button icon="el-icon-upload2" :loading="uploadLoading"
|
||||
@click="dialogVisible = true">导入库存</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.list" v-loading="tableData.loading" row-key="id" lazy :load="load"
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
|
||||
<el-table-column width="30">
|
||||
<template v-slot="scope">
|
||||
<i class="" v-if="scope.row.hasChildren == false"></i>
|
||||
<!-- <div v-if="scope.row.iskaiguans == 1" style="padding-left: 20px;"></div> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品信息" width="200px">
|
||||
<el-table :data="tableData.list" v-loading="tableData.loading">
|
||||
<el-table-column label="商品信息">
|
||||
<template v-slot="scope">
|
||||
<div class="shop_info">
|
||||
<el-image :src="scope.row.img" class="cover" v-if="scope.row.iskaiguans != 1">
|
||||
<el-image :src="scope.row.coverImg" class="cover">
|
||||
<div class="img_error" slot="error">
|
||||
<i class="icon el-icon-document-delete"></i>
|
||||
</div>
|
||||
</el-image>
|
||||
<div class="info">
|
||||
<span>{{ scope.row.name }}</span>
|
||||
<div v-if="scope.row.iskaiguans != 1">
|
||||
<el-tag type="primary">{{ scope.row.type }}</el-tag>
|
||||
<div>
|
||||
<el-tag type="primary">{{ scope.row.typeEnum | typeEnum }}</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格" prop="number">
|
||||
<el-table-column label="库存" prop="stockNumber">
|
||||
<template v-slot="scope">
|
||||
<div v-if="scope.row.iskaiguans">
|
||||
{{ scope.row.specSnap }}
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="库存" prop="number">
|
||||
<template v-slot="scope">
|
||||
<span :class="[scope.row.stockNumber <= warnLine ? 'colorStyle' : '']">
|
||||
{{ `${scope.row.stockNumber} ${scope.row.unitName}` }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="库存开关">
|
||||
<template v-slot="scope">
|
||||
<el-switch v-model="scope.row.isStock" :active-value="1" :inactive-value="0"
|
||||
v-if="scope.row.hasChildren || scope.row.hasChildren == false"
|
||||
@change="showChange($event, scope.row)"></el-switch>
|
||||
<el-switch v-model="scope.row.isStock" :active-value="1" :inactive-value="0"></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="共享库存">
|
||||
<template v-slot="scope">
|
||||
<el-switch v-model="scope.row.isDistribute" :active-value="1" :inactive-value="0"
|
||||
v-if="scope.row.hasChildren || scope.row.hasChildren == false"
|
||||
@change="showChanges($event, scope.row, 'proId', 'distribute')"></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="售罄">
|
||||
<template v-slot="scope">
|
||||
<el-switch v-model="scope.row.isPauseSale" :active-value="1" :inactive-value="0"
|
||||
@change="showChangess($event, scope.row)"></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="上架">
|
||||
<template v-slot="scope">
|
||||
<el-switch v-model="scope.row.isGrounding" :active-value="true" :inactive-value="false"
|
||||
v-if="!scope.row.hasChildren" @change="showChangesss($event, scope.row)"></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="240px">
|
||||
<el-table-column label="操作" width="100">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" size="mini"
|
||||
@click="$refs.invoicingDetail.show(scope.row)">库存记录</el-button>
|
||||
<template v-if="!scope.row.hasChildren">
|
||||
<el-button type="text" size="mini" style="margin-left: 10px !important;"
|
||||
@click="$refs.AddStockTakin.show(scope.row)">库存盘点</el-button>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-pagination @size-change="paginationSizeChange" :total="tableData.total"
|
||||
:current-page="tableData.page + 1" :page-size="tableData.size" @current-change="paginationChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
||||
@current-change="paginationChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
</div>
|
||||
<invoicingDetail ref="invoicingDetail" />
|
||||
<!-- 导入库存弹窗 -->
|
||||
<el-dialog title="导入库存" :visible.sync="dialogVisible">
|
||||
<UploadExcel :beforeUpload="excelSuccessUpload" />
|
||||
</el-dialog>
|
||||
<!-- 预存弹窗组件 -->
|
||||
<el-dialog title="" :visible.sync="dialogTableVisible" width="350px">
|
||||
<el-form>
|
||||
<el-form-item label="库存预存设置" label-width="120px">
|
||||
<el-input v-model="montey" type="number" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogTableVisible = false; montey = ''">取 消</el-button>
|
||||
<el-button type="primary" @click="sumbit()">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!-- 新增库存盘点 -->
|
||||
<AddStockTakin ref="AddStockTakin" @success="resetHandle" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { stock, stockdownload, stockdoImport, stockStatewarnLine, stockStateChanges, stocks, stockStateChangess } from '@/api/invoicing'
|
||||
import { tbShopCategoryGet } from '@/api/shop'
|
||||
import { tbProductGet } from '@/api/invoicing'
|
||||
import settings from '@/settings'
|
||||
import invoicingDetail from './components/invoicingDetail'
|
||||
import AddStockTakin from './components/addStockTakin'
|
||||
import UploadExcel from '@/components/UploadExcel/'
|
||||
import { downloadFile } from "@/utils/index";
|
||||
export default {
|
||||
components: {
|
||||
invoicingDetail,
|
||||
UploadExcel,
|
||||
AddStockTakin
|
||||
invoicingDetail
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
dialogTableVisible: false,
|
||||
montey: "",
|
||||
categorys: [],
|
||||
query: {
|
||||
sort: "", // 排序
|
||||
name: '',
|
||||
isStock: '',
|
||||
num: '',
|
||||
categoryId: ''
|
||||
name: ''
|
||||
},
|
||||
resetQuery: '',
|
||||
downloadLoading: false,
|
||||
uploadLoading: false,
|
||||
warnLine: null, // 警戒线
|
||||
tableData: {
|
||||
page: 0,
|
||||
size: 10,
|
||||
@@ -180,209 +80,48 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
typeEnum(m) {
|
||||
return settings.typeEnum.find(item => item.typeEnum == m).label
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.resetQuery = { ...this.query }
|
||||
this.tbShopCategoryGet()
|
||||
this.getTableData()
|
||||
},
|
||||
methods: {
|
||||
Uppop() {
|
||||
this.dialogTableVisible = true
|
||||
},
|
||||
async sumbit() {
|
||||
try {
|
||||
const res = await stockStatewarnLine({
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
warnLine: this.montey
|
||||
})
|
||||
|
||||
this.$message({ type: 'success', message: '修改成功!' });
|
||||
setTimeout(() => {
|
||||
this.dialogTableVisible = false
|
||||
this.montey = ''
|
||||
this.getTableData()
|
||||
}, 500);
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
async load(tree, treeNode, resolve) {
|
||||
const res = await stocks({
|
||||
productId: tree.proId,
|
||||
})
|
||||
res.forEach(ele => ele.iskaiguans = 1)
|
||||
setTimeout(() => {
|
||||
resolve(res)
|
||||
}, 50);
|
||||
},
|
||||
async excelSuccessUpload(file) {
|
||||
console.log(file);
|
||||
try {
|
||||
this.uploadLoading = true
|
||||
this.dialogVisible = false
|
||||
const res = await stockdoImport(file)
|
||||
this.uploadLoading = false
|
||||
this.$notify.success('导入成功')
|
||||
this.tableData.list = []
|
||||
this.getTableData()
|
||||
} catch (error) {
|
||||
this.dialogVisible = false
|
||||
this.uploadLoading = false
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 导出库存
|
||||
async protHandle() {
|
||||
try {
|
||||
this.downloadLoading = true;
|
||||
const file = await stockdownload({
|
||||
name: this.query.name,
|
||||
isStock: this.query.isStock,
|
||||
num: this.query.num,
|
||||
})
|
||||
downloadFile(file, "商品库存", "xlsx");
|
||||
this.downloadLoading = false;
|
||||
} catch (error) {
|
||||
this.downloadLoading = false;
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 状态切换
|
||||
async showChange(e, row) {
|
||||
await stockStateChanges({
|
||||
"updateKey": 'stock',
|
||||
"updateValue": row.isStock,
|
||||
"targetId": row.proId,
|
||||
shopId: localStorage.getItem('shopId')
|
||||
|
||||
})
|
||||
|
||||
},
|
||||
// 共享库存
|
||||
async showChanges(e, row, name, value) {
|
||||
await stockStateChanges({
|
||||
"updateKey": value,
|
||||
"updateValue": row.isDistribute,
|
||||
"targetId": row[name],
|
||||
shopId: localStorage.getItem('shopId')
|
||||
|
||||
})
|
||||
this.tableData.list = []
|
||||
this.getTableData()
|
||||
|
||||
},
|
||||
// 售罄
|
||||
async showChangess(e, row) {
|
||||
if (row.hasChildren || row.hasChildren == false) {
|
||||
await stockStateChanges({
|
||||
"updateKey": 'pauseSale',
|
||||
"updateValue": row.isPauseSale,
|
||||
"targetId": row.proId,
|
||||
shopId: localStorage.getItem('shopId')
|
||||
|
||||
})
|
||||
} else {
|
||||
await stockStateChanges({
|
||||
"updateKey": 'pauseSaleSku',
|
||||
"updateValue": row.isPauseSale,
|
||||
"targetId": row.skuId,
|
||||
shopId: localStorage.getItem('shopId')
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
// 下架
|
||||
async showChangesss(e, row) {
|
||||
await stockStateChangess({
|
||||
"isGrounding": row.isGrounding,
|
||||
skuId: row.skuId,
|
||||
shopId: localStorage.getItem('shopId')
|
||||
})
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "修改成功"
|
||||
})
|
||||
},
|
||||
async getTableData() {
|
||||
this.tableData.loading = true
|
||||
try {
|
||||
const res = await stock({
|
||||
const res = await tbProductGet({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
sort: this.tableData.sort,
|
||||
name: this.query.name,
|
||||
isStock: this.query.isStock,
|
||||
num: this.query.num,
|
||||
categoryId: this.query.categoryId,
|
||||
sort:this.query.sort,
|
||||
shopId: localStorage.getItem('shopId')
|
||||
})
|
||||
this.tableData.loading = false
|
||||
this.tableData.total = res.totalElements
|
||||
// 多规格数据处理
|
||||
res.content.forEach(element => {
|
||||
if (element.type == '多规格' && element.isDistribute == 0) {
|
||||
element.hasChildren = true
|
||||
} else {
|
||||
element.hasChildren = false
|
||||
this.tableData.list = res.content.map(item => {
|
||||
let stockNumber = 0
|
||||
for (let i of item.skuList) {
|
||||
stockNumber += i.stockNumber
|
||||
}
|
||||
});
|
||||
this.warnLine = res.warnLine
|
||||
this.tableData.list = res.content
|
||||
console.log(this.tableData.list);
|
||||
item.stockNumber = stockNumber
|
||||
return item
|
||||
})
|
||||
this.tableData.total = res.totalElements
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 获取商品分类列表
|
||||
async tbShopCategoryGet() {
|
||||
try {
|
||||
const res = await tbShopCategoryGet({
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
page: 0,
|
||||
size: 100,
|
||||
sort: 'id'
|
||||
})
|
||||
let categorys = []
|
||||
for (let item of res.content) {
|
||||
categorys.push({
|
||||
name: `|----${item.name}`,
|
||||
id: item.id
|
||||
})
|
||||
if (item.childrenList.length) {
|
||||
for (let val of item.childrenList) {
|
||||
categorys.push({
|
||||
name: `|----|----${val.name}`,
|
||||
id: val.id
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
this.categorys = categorys
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
// 每页条数改变是回调
|
||||
paginationSizeChange(e) {
|
||||
console.log(e);
|
||||
this.tableData.size = e
|
||||
this.tableData.page = 0
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
console.log(e)
|
||||
this.tableData.page = e - 1
|
||||
this.tableData.list = []
|
||||
this.getTableData()
|
||||
},
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.query = { ...this.resetQuery }
|
||||
this.query.blurry = ''
|
||||
this.tableData.page = 0;
|
||||
this.tableData.list = []
|
||||
this.getTableData()
|
||||
}
|
||||
}
|
||||
@@ -409,27 +148,4 @@ export default {
|
||||
justify-content: space-between;
|
||||
}
|
||||
}
|
||||
|
||||
.row_wrap {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.colorStyle {
|
||||
color: rgb(231, 42, 42);
|
||||
font-weight: 700;
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
.cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
/* flex-direction: row-reverse; */
|
||||
}
|
||||
</style>
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="head-container">
|
||||
<div class="filter_wrap">
|
||||
<el-date-picker v-model="query.createdAt" type="daterange" range-separator="至" start-placeholder="开始日期"
|
||||
end-placeholder="结束日期" value-format="yyyy-MM-dd" @change="getTableData">
|
||||
end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" @change="getTableData">
|
||||
</el-date-picker>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
@@ -13,13 +13,12 @@
|
||||
<el-table :data="tableData.list" v-loading="tableData.loading">
|
||||
<el-table-column label="类型" prop="type">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.type }}
|
||||
{{ scope.row.type == 'reject' ? '退货出库' : '供应商入库' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="供应商名称" prop="purveyorName"></el-table-column>
|
||||
<el-table-column label="商品数量" prop="totalAmount">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.stockSnap && scope.row.stockSnap.length }}
|
||||
{{ scope.row.stockSnap.length }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" prop="remark"></el-table-column>
|
||||
@@ -33,9 +32,9 @@
|
||||
{{ dayjs(scope.row.stockTime).format('YYYY-MM-DD HH:mm:ss') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="80">
|
||||
<el-table-column label="操作" width="120">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" size="mini" @click="$refs.operatingDetail.show(scope.row)">
|
||||
<el-button type="text" size="mini" @click="$refs.operatingDetail.show(scope.row.id)">
|
||||
详情
|
||||
</el-button>
|
||||
<!-- <el-button type="text" size="mini" @click="$refs.operatingDetail.show(scope.row.id)">
|
||||
@@ -46,9 +45,7 @@
|
||||
</el-table>
|
||||
</div>
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
||||
@current-change="paginationChange"
|
||||
@size-change="e => { tableData.size = e; tableData.page = 0; getTableData() }"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
@current-change="paginationChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
<operatingDetail ref="operatingDetail" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -83,19 +80,12 @@ export default {
|
||||
methods: {
|
||||
async getTableData() {
|
||||
this.tableData.loading = true
|
||||
let arr = []
|
||||
console.log(this.query, 'tiaoshi1')
|
||||
if (this.query.createdAt.length) {
|
||||
arr = [this.query.createdAt[0] + ' 00:00:00', this.query.createdAt[1] + ' 23:59:59']
|
||||
} else {
|
||||
arr = []
|
||||
}
|
||||
try {
|
||||
const res = await tbProductStockOperateList({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
createdAt: arr
|
||||
createdAt: this.query.createdAt
|
||||
})
|
||||
this.tableData.loading = false
|
||||
this.tableData.list = res.content
|
||||
|
||||
@@ -2,18 +2,7 @@
|
||||
<div class="app-container">
|
||||
<div class="head-container">
|
||||
<el-form ref="queryForm" :model="queryForm" :rules="queryRules" label-position="left" label-width="80px">
|
||||
<el-form-item label="入库内容">
|
||||
<div class="shop_type_box">
|
||||
<div class="item" v-for="item in inTabs" :key="item.value"
|
||||
:class="{ active: inTabValue == item.value }" @click="tabChange(item.value, item.type)">
|
||||
<div class="s_title">{{ item.label }}</div>
|
||||
<div class="active_dot">
|
||||
<i class="el-icon-check"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="入库类型" v-if="inTabValue == 'goods'">
|
||||
<el-form-item label="出库类型">
|
||||
<div class="shop_type_box">
|
||||
<div class="item" v-for="(item, index) in shopTypes" :key="index"
|
||||
:class="{ active: shopTypesActive == index }" @click="changeTypeEnum(index)">
|
||||
@@ -24,22 +13,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="入库类型" v-else>
|
||||
<div class="shop_type_box">
|
||||
<div class="item" v-for="(item, index) in shopTypes2" :key="index"
|
||||
:class="{ active: shopTypesActive == index }" @click="changeTypeEnum(index)">
|
||||
<div class="s_title">{{ item.label }}</div>
|
||||
<div class="active_dot">
|
||||
<i class="el-icon-check"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item> -->
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="供应商">
|
||||
<el-select v-model="queryForm.purveyorId" placeholder="请选择供应商" clearable
|
||||
style="width: 220px;" @change="changeTypeEnum">
|
||||
<el-col :span="8" v-if="shopTypes[shopTypesActive].value == 'purveyor'">
|
||||
<el-form-item label="供应商" prop="purveyorId">
|
||||
<el-select v-model="queryForm.purveyorId" placeholder="请选择供应商" style="width: 220px;">
|
||||
<el-option :label="item.purveyorName" :value="item.id" v-for="item in purveyorList"
|
||||
:key="item.id"></el-option>
|
||||
</el-select>
|
||||
@@ -55,13 +32,13 @@
|
||||
</el-row>
|
||||
<el-row v-if="shopTypes[shopTypesActive].value == 'purveyor'">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="应付金额">
|
||||
<el-form-item label="应收金额">
|
||||
<el-input v-model="queryForm.totalAmount" placeholder="请输入应收金额"
|
||||
style="width: 220px;"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="实付金额">
|
||||
<el-form-item label="实收金额">
|
||||
<el-input v-model="queryForm.paidAmount" placeholder="请输入实收金额"
|
||||
style="width: 220px;"></el-input>
|
||||
</el-form-item>
|
||||
@@ -90,98 +67,44 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="$refs.ConsumableList.show(tableData.list)"
|
||||
v-if="inTabValue == 'consumable'">选择耗材</el-button>
|
||||
<el-button type="primary" @click="$refs.shopList.show(tableData.list)" v-else>选择商品</el-button>
|
||||
<el-button type="primary" @click="$refs.shopList.show(tableData.list)">选择商品</el-button>
|
||||
</el-form-item>
|
||||
<el-autocomplete v-model="autocompletename" :fetch-suggestions="querySearchAsync"
|
||||
:value-key="inTabValue == 'goods' ? 'name' : 'conName'"
|
||||
:placeholder="inTabValue == 'goods' ? '商品搜索' : '耗材搜索'" @select="handleSelect"
|
||||
style="width: 500px;"></el-autocomplete>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-button type="primary" plain v-if="inTabValue == 'consumable'">
|
||||
共{{ tableData.list.length }}种耗材,金额合计<span style="color: red;">¥{{ queryForm.totalAmount }}</span>
|
||||
</el-button>
|
||||
<el-button type="primary" plain v-else>
|
||||
<el-button type="primary" plain>
|
||||
共{{ tableData.list.length }}种商品,金额合计<span style="color: red;">¥{{ queryForm.totalAmount }}</span>
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.list" v-if="inTabValue == 'consumable'">
|
||||
<el-table-column label="耗材名称" prop="conName">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.conName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="进价">
|
||||
<template v-slot="scope">
|
||||
<el-input-number v-model="scope.row.price" :min="0" controls-position="right"
|
||||
@change="consCountTotal($event, scope.row, 'price')"></el-input-number>
|
||||
<div class="tips">原价¥{{ scope.row.costPrice }}/{{ scope.row.conUnit }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量">
|
||||
<template v-slot="scope">
|
||||
<el-input-number v-model="scope.row.stockNumber" :min="0" :step="1" step-strictly
|
||||
controls-position="right"
|
||||
@change="consCountTotal($event, scope.row, 'stockNumber')"></el-input-number>
|
||||
<div class="tips">入库前:{{ scope.row.number }}{{ scope.row.conUnit }}
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="小计">
|
||||
<template v-slot="scope">
|
||||
<!-- <el-input-number v-model="scope.row.totalAmount" :min="0"
|
||||
controls-position="right"></el-input-number> -->
|
||||
<el-input :value="formatDecimal(scope.row.price * scope.row.stockNumber)" readonly
|
||||
style="width: 100px;" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="变动后剩余库存">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.stockNumber + scope.row.number }}{{ scope.row.conUnit }}
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="操作" width="80">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text"
|
||||
@click="tableData.list.splice(scope.$index, 1), spliceclick()">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-table :data="tableData.list" v-else>
|
||||
<el-table :data="tableData.list">
|
||||
<el-table-column type="index" width="50"></el-table-column>
|
||||
<el-table-column label="商品名称" prop="name">
|
||||
<template v-slot="scope">
|
||||
<div class="name_wrap">
|
||||
<span class="name">{{ scope.row.name }}</span>
|
||||
<span v-if="scope.row.specSnap">({{ scope.row.specSnap }})</span>
|
||||
<!-- <el-tag type="info" v-if="scope.row.specSnap" size="mini">{{ scope.row.specSnap }}</el-tag> -->
|
||||
<el-tag type="info" v-if="scope.row.specSnap" size="mini">{{ scope.row.specSnap }}</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="进价">
|
||||
<template v-slot="scope">
|
||||
<el-input-number v-model="scope.row.costPrice" :min="0" controls-position="right"
|
||||
@change="modifyPrice($event, scope.row, 'costPrice')"></el-input-number>
|
||||
<el-input-number v-model="scope.row.guidePrice" :min="0" controls-position="right"
|
||||
@change="e => scope.row.totalAmount = e * scope.row.number"></el-input-number>
|
||||
<div class="tips">成本价¥{{ scope.row.costPrice }}/{{ scope.row.unitName }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量">
|
||||
<template v-slot="scope">
|
||||
<el-input-number v-model="scope.row.number" :min="0" :step="1" step-strictly
|
||||
controls-position="right"
|
||||
@change="modifyPrice($event, scope.row, 'number', 'totalAmount')"></el-input-number>
|
||||
<el-input-number v-model="scope.row.number" :min="0" controls-position="right"
|
||||
@change="e => scope.row.totalAmount = e * scope.row.guidePrice"></el-input-number>
|
||||
<div class="tips">入库前:{{ scope.row.stockNumber }}{{ scope.row.unitName }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="小计">
|
||||
<template v-slot="scope">
|
||||
<!-- <el-input-number v-model="scope.row.totalAmount" :min="0"
|
||||
controls-position="right"></el-input-number> -->
|
||||
<el-input :value="scope.row.costPrice * scope.row.number" readonly style="width: 100px;" />
|
||||
<el-input-number v-model="scope.row.totalAmount" :min="0"
|
||||
controls-position="right"></el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="变动后剩余库存">
|
||||
@@ -191,8 +114,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="80">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text"
|
||||
@click="tableData.list.splice(scope.$index, 1), spliceclick()">删除</el-button>
|
||||
<el-button type="text" @click="tableData.list.splice(scope.$index, 1)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -200,10 +122,7 @@
|
||||
<div>
|
||||
<el-button type="primary" @click="submitHandle" :loading="queryFormLoading">确定</el-button>
|
||||
</div>
|
||||
<!-- 选择商品 -->
|
||||
<shopList ref="shopList" @success="selectShop" />
|
||||
<!-- 选择耗材 -->
|
||||
<ConsumableList ref="ConsumableList" @success="selectConsumable" />
|
||||
<el-dialog :visible.sync="showResult" :show-close="false" :close-on-press-escape="false"
|
||||
:close-on-click-modal="false">
|
||||
<el-result icon="success" title="入库提交成功" :subTitle="`共操作${tableData.list.length}件商品`">
|
||||
@@ -220,33 +139,15 @@
|
||||
|
||||
<script>
|
||||
import dayjs from 'dayjs'
|
||||
import shopList from './components/shopList'
|
||||
import ConsumableList from './components/consumableList'
|
||||
import { tbConsInfoGet, tbProductlist } from "@/api/invoicing";
|
||||
import { tbShopPurveyorGet, tbProductStockOperateOutAndOn, stockInOut } from '@/api/invoicing'
|
||||
import { formatDecimal } from '@/utils'
|
||||
import shopList from '@/components/shopList'
|
||||
import { tbShopPurveyorGet, tbProductStockOperateOutAndOn } from '@/api/invoicing'
|
||||
export default {
|
||||
components: {
|
||||
shopList,
|
||||
ConsumableList
|
||||
shopList
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formatDecimal,
|
||||
inTabValue: 'goods',
|
||||
inTabs: [
|
||||
{
|
||||
label: '商品入库',
|
||||
value: 'goods',
|
||||
type: 'purveyor'
|
||||
},
|
||||
{
|
||||
label: '耗材入库',
|
||||
value: 'consumable',
|
||||
type: 'in'
|
||||
}
|
||||
],
|
||||
shopTypesActive: 1,
|
||||
shopTypesActive: 0,
|
||||
shopTypes: [
|
||||
{
|
||||
label: '供应商入库',
|
||||
@@ -257,12 +158,6 @@ export default {
|
||||
value: 'purchase'
|
||||
}
|
||||
],
|
||||
shopTypes2: [
|
||||
{
|
||||
label: '供应商入库',
|
||||
value: 'purveyor'
|
||||
},
|
||||
],
|
||||
resetForm: '',
|
||||
queryFormLoading: false,
|
||||
queryForm: {
|
||||
@@ -282,7 +177,7 @@ export default {
|
||||
purveyorId: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择供应商',
|
||||
message: ' ',
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
@@ -298,10 +193,7 @@ export default {
|
||||
tableData: {
|
||||
list: []
|
||||
},
|
||||
showResult: false,
|
||||
autocompletename: '',
|
||||
restaurants: [],
|
||||
timeout: null
|
||||
showResult: false
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@@ -309,59 +201,22 @@ export default {
|
||||
this.tbShopPurveyorGet()
|
||||
},
|
||||
methods: {
|
||||
async querySearchAsync(queryString, cb) {//快捷搜索
|
||||
let res = null
|
||||
if (this.inTabValue == 'goods') {
|
||||
res = await tbProductlist({
|
||||
page: 0,
|
||||
size: 20,
|
||||
name: queryString ? queryString : '',
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
sort: 'id',
|
||||
})
|
||||
} else {
|
||||
res = await tbConsInfoGet({
|
||||
page: 0,
|
||||
size: 20,
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
conName: queryString ? queryString : ''
|
||||
})
|
||||
|
||||
// 提交
|
||||
submitHandle() {
|
||||
this.$refs.queryForm.validate(async valid => {
|
||||
if (valid) {
|
||||
try {
|
||||
this.queryFormLoading = true
|
||||
this.queryForm.list = this.tableData.list
|
||||
await tbProductStockOperateOutAndOn(this.queryForm)
|
||||
this.queryFormLoading = false
|
||||
this.showResult = true
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
this.queryFormLoading = false
|
||||
}
|
||||
this.restaurants = res.content
|
||||
if (res.content.length == 0) {//给个提示没有搜到
|
||||
this.$message('无此商品');
|
||||
return false
|
||||
}
|
||||
var uniqueArray = this.restaurants.filter(item1 =>
|
||||
!this.tableData.list.some(item2 => item2.productId == item1.id)
|
||||
);
|
||||
clearTimeout(this.timeout);
|
||||
this.timeout = setTimeout(() => {
|
||||
cb(uniqueArray);
|
||||
}, 1000 * Math.random());
|
||||
},
|
||||
handleSelect(item) {//选定后清空
|
||||
this.autocompletename = ''
|
||||
if (this.inTabValue == 'goods') {
|
||||
this.selectShop([item])
|
||||
} else {
|
||||
this.selectConsumable([item])
|
||||
}
|
||||
},
|
||||
//删除计算
|
||||
spliceclick() {
|
||||
var zong = 0
|
||||
if (this.inTabValue == 'goods') {
|
||||
this.tableData.list.forEach(ele => {
|
||||
zong += ele.costPrice * ele.number
|
||||
})
|
||||
} else {
|
||||
this.tableData.list.forEach(ele => {
|
||||
zong += ele.price * ele.stockNumber
|
||||
})
|
||||
}
|
||||
this.queryForm.totalAmount = formatDecimal(zong)
|
||||
},
|
||||
// 选择商品
|
||||
selectShop(res) {
|
||||
@@ -378,147 +233,19 @@ export default {
|
||||
})
|
||||
})
|
||||
})
|
||||
this.tableData.list = [...this.tableData.list, ...arr]
|
||||
console.log(arr)
|
||||
this.tableData.list = arr
|
||||
},
|
||||
// 切换入库内容
|
||||
tabChange(value, type) {
|
||||
this.shopTypesActive = type == 'in' ? 0 : 1
|
||||
this.inTabValue = value
|
||||
this.resetHandle()
|
||||
this.$refs.shopList.clearSelection()//清除选项
|
||||
this.$refs.ConsumableList.clearSelection()//清除选项
|
||||
},
|
||||
// 计算耗材总价
|
||||
consCountTotal(cvalue, row, key1, key2 = undefined) {
|
||||
if (cvalue == undefined) {
|
||||
setTimeout(() => {
|
||||
row[key1] = 0
|
||||
|
||||
let zong = 0
|
||||
this.tableData.list.forEach(ele => {
|
||||
zong += ele.price * ele.stockNumber
|
||||
})
|
||||
this.queryForm.totalAmount = formatDecimal(zong)
|
||||
}, 10)
|
||||
} else {
|
||||
row[key1] = cvalue
|
||||
|
||||
let zong = 0
|
||||
this.tableData.list.forEach(ele => {
|
||||
zong += ele.price * ele.stockNumber
|
||||
})
|
||||
this.queryForm.totalAmount = formatDecimal(zong)
|
||||
}
|
||||
},
|
||||
// 计算商品总价
|
||||
modifyPrice(cvalue, row, key1, key2 = undefined) {
|
||||
if (cvalue == undefined) {
|
||||
setTimeout(() => {
|
||||
row[key1] = 0
|
||||
row[key2] = 0
|
||||
|
||||
let zong = 0
|
||||
this.tableData.list.forEach(ele => {
|
||||
zong += ele.costPrice * ele.number
|
||||
})
|
||||
this.queryForm.totalAmount = formatDecimal(zong)
|
||||
}, 10)
|
||||
} else {
|
||||
row[key1] = cvalue
|
||||
row[key2] = cvalue
|
||||
let zong = 0
|
||||
this.tableData.list.forEach(ele => {
|
||||
zong += ele.costPrice * ele.number
|
||||
})
|
||||
this.queryForm.totalAmount = formatDecimal(zong)
|
||||
}
|
||||
},
|
||||
// 提交
|
||||
submitHandle() {
|
||||
if (this.tableData.list.length == 0) {
|
||||
switch (this.inTabValue) {
|
||||
case 'goods':
|
||||
this.$message('请先选择商品!');
|
||||
break;
|
||||
case 'consumable':
|
||||
this.$message('请先选择耗材!');
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false
|
||||
}
|
||||
this.$refs.queryForm.validate(async valid => {
|
||||
if (valid) {
|
||||
try {
|
||||
this.queryFormLoading = true
|
||||
switch (this.inTabValue) {
|
||||
case 'goods':
|
||||
this.queryForm.list = this.tableData.list
|
||||
await tbProductStockOperateOutAndOn(this.queryForm)
|
||||
break;
|
||||
case 'consumable':
|
||||
this.queryForm.accountsPayable = this.queryForm.totalAmount
|
||||
this.queryForm.actualPayment = this.queryForm.paidAmount
|
||||
this.queryForm.paymentTime = this.queryForm.paidAt
|
||||
this.queryForm.supplierId = this.queryForm.purveyorId
|
||||
this.queryForm.list = this.tableData.list
|
||||
await stockInOut(this.queryForm)
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
this.queryFormLoading = false
|
||||
this.showResult = true
|
||||
this.$refs.shopList.clearSelection()//清除选项
|
||||
this.$refs.ConsumableList.clearSelection()//清除选项
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
this.queryFormLoading = false
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 选择耗材
|
||||
selectConsumable(res) {
|
||||
let arr = res.map(item => {
|
||||
item.number = formatDecimal(item.stockNumber - item.stockConsume, 2, true)
|
||||
item.stockNumber = 0
|
||||
item.costPrice = item.price
|
||||
item.conInfold = item.id
|
||||
return item
|
||||
})
|
||||
this.tableData.list = [...this.tableData.list, ...arr]
|
||||
},
|
||||
|
||||
// 初始化
|
||||
resetHandle() {
|
||||
this.showResult = false
|
||||
this.queryForm = { ...this.resetForm }
|
||||
if (this.inTabValue == 'goods') {
|
||||
this.queryForm.type = this.shopTypes[this.shopTypesActive].value
|
||||
} else {
|
||||
this.queryForm.type = this.inTabs.find(item => item.value == this.inTabValue).type
|
||||
}
|
||||
this.tableData.list = []
|
||||
this.$refs.queryForm.resetFields()
|
||||
this.$refs.queryForm.resetFields()
|
||||
},
|
||||
// 切换类型
|
||||
changeTypeEnum(index) {
|
||||
console.log(this.inTabValue)
|
||||
if (this.inTabValue == 'consumable') {
|
||||
return false
|
||||
}
|
||||
if (this.queryForm.purveyorId) {
|
||||
this.shopTypesActive = 0
|
||||
} else {
|
||||
this.shopTypesActive = 1
|
||||
}
|
||||
this.queryForm.type = this.shopTypes[this.shopTypesActive].value
|
||||
// console.log(index)
|
||||
// this.shopTypesActive = index
|
||||
// this.queryForm.type = this.shopTypes[index].value
|
||||
this.shopTypesActive = index
|
||||
this.queryForm.type = this.shopTypes[index].value
|
||||
},
|
||||
// 获取供应商列表
|
||||
async tbShopPurveyorGet() {
|
||||
|
||||
@@ -2,18 +2,7 @@
|
||||
<div class="app-container">
|
||||
<div class="head-container">
|
||||
<el-form ref="queryForm" :model="queryForm" :rules="queryRules" label-position="left" label-width="80px">
|
||||
<el-form-item label="出库内容">
|
||||
<div class="shop_type_box">
|
||||
<div class="item" v-for="item in inTabs" :key="item.value"
|
||||
:class="{ active: inTabValue == item.value }" @click="tabChange(item.value, item.type)">
|
||||
<div class="s_title">{{ item.label }}</div>
|
||||
<div class="active_dot">
|
||||
<i class="el-icon-check"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="出库类型" v-if="inTabValue == 'goods'">
|
||||
<el-form-item label="出库类型">
|
||||
<div class="shop_type_box">
|
||||
<div class="item" v-for="(item, index) in shopTypes" :key="index"
|
||||
:class="{ active: shopTypesActive == index }" @click="changeTypeEnum(index)">
|
||||
@@ -24,22 +13,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="出库类型" v-else>
|
||||
<div class="shop_type_box">
|
||||
<div class="item" v-for="(item, index) in shopTypes2" :key="index"
|
||||
:class="{ active: shopTypesActive == index }" @click="changeTypeEnum(index)">
|
||||
<div class="s_title">{{ item.label }}</div>
|
||||
<div class="active_dot">
|
||||
<i class="el-icon-check"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item> -->
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="供应商">
|
||||
<el-select clearable v-model="queryForm.purveyorId" placeholder="请选择供应商"
|
||||
style="width: 220px;" @change="changeTypeEnum">
|
||||
<el-col :span="8" v-if="shopTypes[shopTypesActive].value == 'reject'">
|
||||
<el-form-item label="供应商" prop="purveyorId">
|
||||
<el-select v-model="queryForm.purveyorId" placeholder="请选择供应商" style="width: 220px;">
|
||||
<el-option :label="item.purveyorName" :value="item.id" v-for="item in purveyorList"
|
||||
:key="item.id"></el-option>
|
||||
</el-select>
|
||||
@@ -62,8 +39,7 @@
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="实收金额">
|
||||
<el-input v-model="queryForm.paidAmount" placeholder="请输入实收金额"
|
||||
style="width: 220px;"></el-input>
|
||||
<el-input v-model="queryForm.paidAmount" placeholder="请输入实收金额" style="width: 220px;"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -77,8 +53,7 @@
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="批号">
|
||||
<el-input v-model="queryForm.batchNumber" placeholder="请输入批号"
|
||||
style="width: 220px;"></el-input>
|
||||
<el-input v-model="queryForm.batchNumber" placeholder="请输入批号" style="width: 220px;"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -90,15 +65,8 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="$refs.ConsumableList.show(tableData.list)"
|
||||
v-if="inTabValue == 'consumable'">选择耗材</el-button>
|
||||
<el-button type="primary" @click="$refs.shopList.show(tableData.list)" v-else>选择商品</el-button>
|
||||
<el-button type="primary" @click="$refs.shopList.show(tableData.list)">选择商品</el-button>
|
||||
</el-form-item>
|
||||
<el-autocomplete v-model="autocompletename" :fetch-suggestions="querySearchAsync"
|
||||
:value-key="inTabValue == 'goods' ? 'name' : 'conName'"
|
||||
:placeholder="inTabValue == 'goods' ? '商品搜索' : '耗材搜索'" @select="handleSelect"
|
||||
style="width: 500px;"></el-autocomplete>
|
||||
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
@@ -107,48 +75,7 @@
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.list" v-if="inTabValue == 'consumable'">
|
||||
<el-table-column label="耗材名称" prop="conName">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.conName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="进价">
|
||||
<template v-slot="scope">
|
||||
<el-input-number v-model="scope.row.price" :min="0" controls-position="right"
|
||||
@change="consCountTotal($event, scope.row, 'price')"></el-input-number>
|
||||
<div class="tips">原价¥{{ scope.row.costPrice }}/{{ scope.row.conUnit }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量">
|
||||
<template v-slot="scope">
|
||||
<el-input-number v-model="scope.row.stockNumber" :min="0" :step="1" step-strictly
|
||||
controls-position="right"
|
||||
@change="consCountTotal($event, scope.row, 'stockNumber')"></el-input-number>
|
||||
<div class="tips">出库前:{{ scope.row.number }}{{ scope.row.conUnit }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="小计">
|
||||
<template v-slot="scope">
|
||||
<!-- <el-input-number v-model="scope.row.totalAmount" :min="0"
|
||||
controls-position="right"></el-input-number> -->
|
||||
<el-input :value="formatDecimal(scope.row.price * scope.row.stockNumber)" readonly
|
||||
style="width: 100px;" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="变动后剩余库存">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.stockNumber - scope.row.number }}{{ scope.row.conUnit }}
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="操作" width="80">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text"
|
||||
@click="tableData.list.splice(scope.$index, 1), spliceclick()">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-table :data="tableData.list" v-else>
|
||||
<el-table :data="tableData.list">
|
||||
<el-table-column type="index" width="50"></el-table-column>
|
||||
<el-table-column label="商品名称" prop="name">
|
||||
<template v-slot="scope">
|
||||
@@ -160,23 +87,22 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="进价">
|
||||
<template v-slot="scope">
|
||||
<el-input-number v-model="scope.row.costPrice" :min="0" controls-position="right"
|
||||
@change="modifyPrice($event, scope.row, 'costPrice')"></el-input-number>
|
||||
<el-input-number v-model="scope.row.guidePrice" :min="0" controls-position="right"
|
||||
@change="e => scope.row.totalAmount = e * scope.row.number"></el-input-number>
|
||||
<div class="tips">成本价¥{{ scope.row.costPrice }}/{{ scope.row.unitName }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量">
|
||||
<template v-slot="scope">
|
||||
<el-input-number v-model="scope.row.number" :min="0" controls-position="right"
|
||||
@change="modifyPrice($event, scope.row, 'number', 'totalAmount')"></el-input-number>
|
||||
@change="e => scope.row.totalAmount = e * scope.row.guidePrice"></el-input-number>
|
||||
<div class="tips">出库前:{{ scope.row.stockNumber }}{{ scope.row.unitName }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="小计">
|
||||
<template v-slot="scope">
|
||||
<!-- <el-input-number v-model="scope.row.totalAmount" :min="0"
|
||||
controls-position="right"></el-input-number> -->
|
||||
<el-input :value="scope.row.costPrice * scope.row.number" readonly style="width: 100px;" />
|
||||
<el-input-number v-model="scope.row.totalAmount" :min="0"
|
||||
controls-position="right"></el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="变动后剩余库存">
|
||||
@@ -186,8 +112,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="80">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text"
|
||||
@click=" tableData.list.splice(scope.$index, 1), spliceclick()">删除</el-button>
|
||||
<el-button type="text" @click="tableData.list.splice(scope.$index, 1)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -195,10 +120,7 @@
|
||||
<div>
|
||||
<el-button type="primary" @click="submitHandle" :loading="queryFormLoading">确定</el-button>
|
||||
</div>
|
||||
<!-- 选择商品 -->
|
||||
<shopList ref="shopList" @success="selectShop" />
|
||||
<!-- 选择耗材 -->
|
||||
<ConsumableList ref="ConsumableList" @success="selectConsumable" />
|
||||
<el-dialog :visible.sync="showResult" :show-close="false" :close-on-press-escape="false"
|
||||
:close-on-click-modal="false">
|
||||
<el-result icon="success" title="出库提交成功" :subTitle="`共操作${tableData.list.length}件商品`">
|
||||
@@ -215,33 +137,15 @@
|
||||
|
||||
<script>
|
||||
import dayjs from 'dayjs'
|
||||
import shopList from './components/shopList'
|
||||
import ConsumableList from './components/consumableList'
|
||||
import { tbShopPurveyorGet, tbProductStockOperateOutAndOn, stockInOut, tbConsInfoGet, tbProductlist } from '@/api/invoicing'
|
||||
|
||||
import { formatDecimal } from '@/utils'
|
||||
import shopList from '@/components/shopList'
|
||||
import { tbShopPurveyorGet, tbProductStockOperateOutAndOn } from '@/api/invoicing'
|
||||
export default {
|
||||
components: {
|
||||
shopList,
|
||||
ConsumableList
|
||||
shopList
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formatDecimal,
|
||||
inTabValue: 'goods',
|
||||
inTabs: [
|
||||
{
|
||||
label: '商品出库',
|
||||
value: 'goods',
|
||||
type: 'reject'
|
||||
},
|
||||
{
|
||||
label: '耗材出库',
|
||||
value: 'consumable',
|
||||
type: 'out'
|
||||
}
|
||||
],
|
||||
shopTypesActive: 1,
|
||||
shopTypesActive: 0,
|
||||
shopTypes: [
|
||||
{
|
||||
label: '供应商退货',
|
||||
@@ -252,12 +156,6 @@ export default {
|
||||
value: 'other-out'
|
||||
}
|
||||
],
|
||||
shopTypes2: [
|
||||
{
|
||||
label: '供应商退货',
|
||||
value: 'reject'
|
||||
}
|
||||
],
|
||||
resetForm: '',
|
||||
queryFormLoading: false,
|
||||
queryForm: {
|
||||
@@ -271,7 +169,7 @@ export default {
|
||||
time: dayjs().format('YYYY-MM-DD'),
|
||||
totalAmount: 0,
|
||||
type: 'reject',
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
shopId: localStorage.getItem('shopId')
|
||||
},
|
||||
queryRules: {
|
||||
purveyorId: [
|
||||
@@ -293,10 +191,7 @@ export default {
|
||||
tableData: {
|
||||
list: []
|
||||
},
|
||||
showResult: false,
|
||||
autocompletename: '',
|
||||
restaurants: [],
|
||||
timeout: null
|
||||
showResult: false
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@@ -304,155 +199,16 @@ export default {
|
||||
this.tbShopPurveyorGet()
|
||||
},
|
||||
methods: {
|
||||
async querySearchAsync(queryString, cb) {//快捷搜索
|
||||
let res = null
|
||||
if (this.inTabValue == 'goods') {
|
||||
res = await tbProductlist({
|
||||
page: 0,
|
||||
size: 20,
|
||||
name: queryString ? queryString : '',
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
sort: 'id',
|
||||
})
|
||||
} else {
|
||||
res = await tbConsInfoGet({
|
||||
page: 0,
|
||||
size: 20,
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
conName: queryString ? queryString : ''
|
||||
})
|
||||
|
||||
}
|
||||
this.restaurants = res.content
|
||||
if (res.content.length == 0) {//给个提示没有搜到
|
||||
this.$message('无此商品');
|
||||
return false
|
||||
}
|
||||
var uniqueArray = this.restaurants.filter(item1 =>
|
||||
!this.tableData.list.some(item2 => item2.productId == item1.id)
|
||||
);
|
||||
clearTimeout(this.timeout);
|
||||
this.timeout = setTimeout(() => {
|
||||
cb(uniqueArray);
|
||||
}, 1000 * Math.random());
|
||||
},
|
||||
handleSelect(item) {//选定后清空
|
||||
this.autocompletename = ''
|
||||
if (this.inTabValue == 'goods') {
|
||||
this.selectShop([item])
|
||||
} else {
|
||||
this.selectConsumable([item])
|
||||
}
|
||||
},
|
||||
// 切换入库内容
|
||||
tabChange(value, type) {
|
||||
this.inTabValue = value
|
||||
this.shopTypesActive = 1
|
||||
this.resetHandle()
|
||||
this.queryForm.type = type
|
||||
this.$refs.shopList.clearSelection()//清除选项
|
||||
this.$refs.ConsumableList.clearSelection()//清除选项
|
||||
},
|
||||
//删除计算
|
||||
spliceclick() {
|
||||
var zong = 0
|
||||
if (this.inTabValue == 'goods') {
|
||||
this.tableData.list.forEach(ele => {
|
||||
zong += ele.costPrice * ele.number
|
||||
})
|
||||
} else {
|
||||
this.tableData.list.forEach(ele => {
|
||||
zong += ele.price * ele.stockNumber
|
||||
})
|
||||
}
|
||||
this.queryForm.totalAmount = formatDecimal(zong)
|
||||
},
|
||||
// 计算耗材总价
|
||||
consCountTotal(cvalue, row, key1, key2 = undefined) {
|
||||
if (cvalue == undefined) {
|
||||
setTimeout(() => {
|
||||
row[key1] = 0
|
||||
|
||||
let zong = 0
|
||||
this.tableData.list.forEach(ele => {
|
||||
zong += ele.price * ele.stockNumber
|
||||
})
|
||||
this.queryForm.totalAmount = formatDecimal(zong)
|
||||
}, 10)
|
||||
} else {
|
||||
row[key1] = cvalue
|
||||
|
||||
let zong = 0
|
||||
this.tableData.list.forEach(ele => {
|
||||
zong += ele.price * ele.stockNumber
|
||||
})
|
||||
this.queryForm.totalAmount = formatDecimal(zong)
|
||||
}
|
||||
},
|
||||
// 计算商品总价
|
||||
modifyPrice(cvalue, row, key1, key2 = undefined) {
|
||||
if (cvalue == undefined) {
|
||||
setTimeout(() => {
|
||||
row[key1] = 0
|
||||
row[key2] = 0
|
||||
|
||||
let zong = 0
|
||||
this.tableData.list.forEach(ele => {
|
||||
zong += ele.costPrice * ele.number
|
||||
})
|
||||
this.queryForm.totalAmount = formatDecimal(zong)
|
||||
}, 10)
|
||||
} else {
|
||||
row[key1] = cvalue
|
||||
row[key2] = cvalue
|
||||
|
||||
let zong = 0
|
||||
this.tableData.list.forEach(ele => {
|
||||
zong += ele.costPrice * ele.number
|
||||
})
|
||||
this.queryForm.totalAmount = formatDecimal(zong)
|
||||
}
|
||||
},
|
||||
// 提交
|
||||
submitHandle() {
|
||||
if (this.tableData.list.length == 0) {
|
||||
switch (this.inTabValue) {
|
||||
case 'goods':
|
||||
this.$message('请先选择商品入!');
|
||||
break;
|
||||
case 'consumable':
|
||||
this.$message('请先选择耗材!');
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false
|
||||
}
|
||||
this.$refs.queryForm.validate(async valid => {
|
||||
if (valid) {
|
||||
try {
|
||||
this.queryFormLoading = true
|
||||
switch (this.inTabValue) {
|
||||
case 'goods':
|
||||
this.queryForm.list = this.tableData.list
|
||||
await tbProductStockOperateOutAndOn(this.queryForm)
|
||||
break;
|
||||
case 'consumable':
|
||||
this.queryForm.accountsPayable = this.queryForm.totalAmount
|
||||
this.queryForm.actualPayment = this.queryForm.paidAmount
|
||||
this.queryForm.paymentTime = this.queryForm.paidAt
|
||||
this.queryForm.supplierId = this.queryForm.purveyorId
|
||||
this.queryForm.list = this.tableData.list
|
||||
this.queryForm.type = 'out'
|
||||
await stockInOut(this.queryForm)
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
this.queryFormLoading = false
|
||||
this.showResult = true
|
||||
this.$refs.shopList.clearSelection()//清除选项
|
||||
this.$refs.ConsumableList.clearSelection()//清除选项
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
this.queryFormLoading = false
|
||||
@@ -460,17 +216,6 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
// 选择耗材
|
||||
selectConsumable(res) {
|
||||
let arr = res.map(item => {
|
||||
item.number = formatDecimal(item.stockNumber - item.stockConsume, 2, true)
|
||||
item.stockNumber = 0
|
||||
item.costPrice = item.price
|
||||
item.conInfold = item.id
|
||||
return item
|
||||
})
|
||||
this.tableData.list = [...this.tableData.list, ...arr]
|
||||
},
|
||||
// 选择商品
|
||||
selectShop(res) {
|
||||
let arr = []
|
||||
@@ -486,30 +231,19 @@ export default {
|
||||
})
|
||||
})
|
||||
})
|
||||
this.tableData.list = [...this.tableData.list, ...arr]
|
||||
console.log(arr)
|
||||
this.tableData.list = arr
|
||||
},
|
||||
// 初始化
|
||||
resetHandle() {
|
||||
this.showResult = false
|
||||
this.queryForm = { ...this.resetForm }
|
||||
if (this.inTabValue == 'goods') {
|
||||
this.queryForm.type = this.shopTypes[this.shopTypesActive].value
|
||||
} else {
|
||||
this.queryForm.type = this.inTabs.find(item => item.value == this.inTabValue).type
|
||||
}
|
||||
this.tableData.list = []
|
||||
this.$refs.queryForm.resetFields()
|
||||
},
|
||||
// 切换类型
|
||||
changeTypeEnum(index) {
|
||||
if (this.queryForm.purveyorId) {
|
||||
this.shopTypesActive = 0
|
||||
} else {
|
||||
this.shopTypesActive = 1
|
||||
}
|
||||
this.queryForm.type = this.shopTypes[this.shopTypesActive].value
|
||||
// this.shopTypesActive = index
|
||||
// this.queryForm.type = this.shopTypes[index].value
|
||||
this.shopTypesActive = index
|
||||
this.queryForm.type = this.shopTypes[index].value
|
||||
},
|
||||
// 获取供应商列表
|
||||
async tbShopPurveyorGet() {
|
||||
|
||||
@@ -1,165 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="head-container">
|
||||
<div class="filter_wrap">
|
||||
<el-input v-model="query.name" size="small" clearable placeholder="供应商"
|
||||
@keyup.enter.native="getTableData" style="width: 200px;" />
|
||||
<el-select v-model="query.type" placeholder="选择类型">
|
||||
<el-option label="进货" value="purveyor"></el-option>
|
||||
<el-option label="退货" value="reject"></el-option>
|
||||
</el-select>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-button type="primary" icon="el-icon-plus" @click="$refs.addSupplier.show()">添加供应商</el-button>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.list" v-loading="tableData.loading">
|
||||
<el-table-column label="供应商" prop="purveyorName"></el-table-column>
|
||||
<el-table-column label="联系电话" prop="purveyorTelephone"></el-table-column>
|
||||
<el-table-column label="地址" prop="address"></el-table-column>
|
||||
<!-- <el-table-column label="标签" prop="tip"></el-table-column> -->
|
||||
<el-table-column label="备注" prop="remark"></el-table-column>
|
||||
<el-table-column label="剩余付款金额" prop="waitAmount">
|
||||
<template v-slot="scope">
|
||||
<span class="num">
|
||||
¥{{ scope.row.waitAmount }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="待付款笔数" prop="waitCount">
|
||||
<template v-slot="scope">
|
||||
<template v-if="scope.row.waitCount > 0">
|
||||
有<span class="count">{{ scope.row.waitCount }}笔</span>未付
|
||||
</template>
|
||||
<template v-else>-</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" prop="type">
|
||||
<template v-slot="scope">
|
||||
<el-tag :type="scope.row.type == 0 ? 'warning' : 'success'">
|
||||
{{ scope.row.type == 0 ? '待支付' : '已完结' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="上笔进货日期" prop="lastTransactAt">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.lastTransactAt && dayjs(scope.row.lastTransactAt).format('YYYY-MM-DD HH:mm:ss') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="250">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" size="mini" round icon="el-icon-edit"
|
||||
@click="$refs.addSupplier.show(scope.row)">编辑</el-button>
|
||||
<el-popconfirm title="确定删除吗?" @confirm="delHandle([scope.row.id])">
|
||||
<el-button type="text" size="mini" round icon="el-icon-delete" slot="reference">
|
||||
删除
|
||||
</el-button>
|
||||
</el-popconfirm>
|
||||
<router-link :to="{ name: 'purchase_detail', query: { purveyorId: scope.row.id } }">
|
||||
<el-button type="text" size="mini">结款记录</el-button>
|
||||
</router-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
||||
@current-change="paginationChange" @size-change="pagesizeChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
<addSupplier ref="addSupplier" @success="getTableData" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import dayjs from 'dayjs'
|
||||
import { tbShopPurveyorGets, tbShopPurveyor } from '@/api/invoicing'
|
||||
import addSupplier from './components/addSupplier'
|
||||
export default {
|
||||
components: {
|
||||
addSupplier
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dayjs,
|
||||
query: {
|
||||
name: '',
|
||||
type: ""
|
||||
},
|
||||
tableData: {
|
||||
page: 0,
|
||||
size: 10,
|
||||
total: 0,
|
||||
sort: 'id',
|
||||
loading: false,
|
||||
list: []
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getTableData()
|
||||
},
|
||||
methods: {
|
||||
// 删除
|
||||
async delHandle(ids) {
|
||||
try {
|
||||
await tbShopPurveyor(ids, 'delete')
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: `删除成功`,
|
||||
type: 'success'
|
||||
});
|
||||
this.getTableData()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
async getTableData() {
|
||||
this.tableData.loading = true
|
||||
try {
|
||||
const res = await tbShopPurveyorGets({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
sort: this.tableData.sort,
|
||||
purveyorName: this.query.name,
|
||||
type: this.query.type,
|
||||
shopId: localStorage.getItem('shopId')
|
||||
})
|
||||
this.tableData.loading = false
|
||||
this.tableData.list = res.content
|
||||
this.tableData.total = res.totalElements
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.query.name = ''
|
||||
this.query.type = ''
|
||||
this.tableData.page = 0;
|
||||
this.getTableData()
|
||||
},
|
||||
pagesizeChange(e) {
|
||||
this.tableData.size = e
|
||||
this.tableData.page = 0;
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1
|
||||
this.getTableData()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.num {
|
||||
color: #F56C6C;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.count {
|
||||
color: #409EFF;
|
||||
}
|
||||
</style>
|
||||
@@ -5,8 +5,7 @@
|
||||
<el-input v-model="query.name" clearable placeholder="供应商" @keyup.enter.native="getTableData"
|
||||
style="width: 200px;" />
|
||||
<el-select v-model="query.type" placeholder="付款状态">
|
||||
<el-option label="待支付" value="0"></el-option>
|
||||
<el-option label="已完结" value="1"></el-option>
|
||||
<el-option :label="item.label" :value="item.value" v-for="item in types" :key="item.id"></el-option>
|
||||
</el-select>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
@@ -38,7 +37,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="上笔进货日期" prop="lastTransactAt">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.lastTransactAt && dayjs(scope.row.lastTransactAt).format('YYYY-MM-DD HH:mm:ss') }}
|
||||
{{ dayjs(scope.row.lastTransactAt).format('YYYY-MM-DD HH:mm:ss') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="80">
|
||||
@@ -78,6 +77,7 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.dictDetail()
|
||||
this.getTableData()
|
||||
},
|
||||
methods: {
|
||||
@@ -111,6 +111,14 @@ export default {
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1
|
||||
this.getTableData()
|
||||
},
|
||||
async dictDetail() {
|
||||
const { content } = await dictDetail({
|
||||
dictName: 'purveyor_transact_status',
|
||||
size: 100,
|
||||
page: 0
|
||||
})
|
||||
this.types = content
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,13 +13,8 @@
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<div class="filter_wrap">
|
||||
<el-select v-model="query.status" placeholder="付款状态">
|
||||
<el-option label="待支付" value="0"></el-option>
|
||||
<el-option label="已付款" value="1"></el-option>
|
||||
</el-select>
|
||||
<el-select v-model="query.type" placeholder="选择类型">
|
||||
<el-option label="进货" value="purveyor"></el-option>
|
||||
<el-option label="退货" value="reject"></el-option>
|
||||
<el-select v-model="query.type" placeholder="付款状态">
|
||||
<el-option :label="item.label" :value="item.value" v-for="item in types" :key="item.id"></el-option>
|
||||
</el-select>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
@@ -65,7 +60,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="head-container">
|
||||
<div class="head-container">
|
||||
<div class="select_count_wrap">
|
||||
<div class="select_count">
|
||||
<i class="icon el-icon-warning"></i>
|
||||
@@ -75,7 +70,7 @@
|
||||
</div>
|
||||
<el-button>批量付款</el-button>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.list" v-loading="tableData.loading" @select="selectHandle"
|
||||
@select-all="selectHandle">
|
||||
@@ -87,104 +82,52 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="类型" prop="type">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.type | typeFilter }}
|
||||
进货单
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="应付金额" prop="totalAmount">
|
||||
<el-table-column label="总金额" prop="totalAmount">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.totalAmount }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="已付款金额" prop="totalAmount">
|
||||
<template v-slot="scope">
|
||||
<span style="color: #47B505;">
|
||||
¥{{ scope.row.paidAmount }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="待付款金额" prop="waitAmount">
|
||||
<template v-slot="scope">
|
||||
<span class="num"> ¥{{ scope.row.waitAmount }}</span>
|
||||
<span class="num" v-if="scope.row.waitAmount > 0">¥{{ scope.row.waitAmount }}</span>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" prop="status">
|
||||
<template v-slot="scope">
|
||||
<el-tag type="info">
|
||||
{{ types.find(item => item.value == scope.row.status).label }}
|
||||
</el-tag>
|
||||
<el-tag type="info">{{ types.find(item => item.value == scope.row.status).label }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="付款方式" prop="payType"></el-table-column>
|
||||
<el-table-column label="备注" prop="remark"></el-table-column>
|
||||
<el-table-column label="付款时间" prop="updatedAt">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.paidAt && dayjs(scope.row.paidAt).format('YYYY-MM-DD HH:mm:ss') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center">
|
||||
<el-table-column label="操作" width="80">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" size="mini" round @click="Uppop(scope.row.id)">付款</el-button>
|
||||
<el-button type="text" size="mini"
|
||||
@click="typedialogshowsumbit(scope.row.id)">账单付款记录</el-button>
|
||||
<router-link :to="{ name: 'purchase_detail', query: { purveyorId: scope.row.purveyorId } }">
|
||||
<el-button type="text" size="mini">查看详情</el-button>
|
||||
</router-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
||||
@current-change="paginationChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
<!-- 付款弹窗组件 -->
|
||||
<el-dialog title="" :visible.sync="dialogTableVisible" width="350px">
|
||||
<el-form :rules="rules" ref="ruleForm" :model="ruleForm">
|
||||
<el-form-item label="付款金额" label-width="80px" prop="montey">
|
||||
<el-input v-model="ruleForm.montey" placeholder="请输入金额" type="number" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="付款方式" label-width="80px">
|
||||
<el-input v-model="ruleForm.payType" placeholder="请输入付款方式" type="text"
|
||||
autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" label-width="80px">
|
||||
<el-input v-model="ruleForm.remark" placeholder="请输备注" type="text" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogTableVisible = false; ruleForm.montey = ''; ruleForm.payType = ''">取
|
||||
消</el-button>
|
||||
<el-button type="primary" @click="sumbit('ruleForm')">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-dialog title="账单付款记录" :visible.sync="typedialogshow">
|
||||
<div class="head-container">
|
||||
<el-input v-model="querytypedialogshow.type" size="small" clearable placeholder="支付方式"
|
||||
style="width: 100%;" class="filter-item" @keyup.enter.native="getTableDatatype" />
|
||||
<div style="margin-top: 10px;">
|
||||
<el-button type="primary" @click="getTableDatatype">查询</el-button>
|
||||
<el-button @click="resetHandletype">重置</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-table ref="table" :data="tableDatatype.data" v-loading="tableDatatype.loading" row-key="id">
|
||||
<el-table-column label="支付方式" prop="payType" />
|
||||
<el-table-column label="支付金额" prop="paidAmount" />
|
||||
<el-table-column label="备注" prop="remark" />
|
||||
<el-table-column label="创建时间" prop="createTime">
|
||||
<template v-slot="scope">
|
||||
{{ dayjs(scope.row.createTime).format('YYYY-MM-DD HH:mm:ss') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import dayjs from 'dayjs'
|
||||
import { tbShopPurveyorTransactInfo, paidAmount, dictDetail, tbShopPurveyorTransactSum, tbShopPurveyorTransacttransactPayInfos } from '@/api/invoicing'
|
||||
import { tbShopPurveyorTransactInfo, dictDetail, tbShopPurveyorTransactSum } from '@/api/invoicing'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 付款当前的id
|
||||
idinfo: "",
|
||||
dayjs,
|
||||
dialogTableVisible: false,
|
||||
timeList: [
|
||||
{
|
||||
label: '全部',
|
||||
@@ -219,29 +162,10 @@ export default {
|
||||
value: 'custom'
|
||||
}
|
||||
],
|
||||
types: [
|
||||
{
|
||||
value: 0,
|
||||
label: '待付款'
|
||||
},
|
||||
{
|
||||
value: 1,
|
||||
label: '已付款'
|
||||
},
|
||||
{
|
||||
value: '-1',
|
||||
label: '作废'
|
||||
}
|
||||
],
|
||||
ruleForm: {
|
||||
montey: null,
|
||||
payType: null,
|
||||
remark: ""
|
||||
},
|
||||
types: [],
|
||||
selectCount: 0,
|
||||
query: {
|
||||
type: '',
|
||||
status: '',
|
||||
time: 'all',
|
||||
createdAt: []
|
||||
},
|
||||
@@ -253,65 +177,15 @@ export default {
|
||||
loading: false,
|
||||
list: []
|
||||
},
|
||||
info: '',
|
||||
rules: {
|
||||
montey: [
|
||||
{ required: true, message: '请输入金额', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
typedialogshow: false,//查看详情
|
||||
querytypedialogshow: {
|
||||
type: '',
|
||||
id: ''
|
||||
},
|
||||
tableDatatype: {
|
||||
page: 0,
|
||||
size: 10,
|
||||
total: 0,
|
||||
loading: false,
|
||||
list: []
|
||||
}
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
typeFilter(t) {
|
||||
const m = {
|
||||
purveyor: '进货单',
|
||||
reject: '退货单',
|
||||
cons_in: '耗材入库',
|
||||
cons_out: '耗材出库'
|
||||
}
|
||||
return m[t]
|
||||
info: ''
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.dictDetail()
|
||||
this.getTableData()
|
||||
this.tbShopPurveyorTransactSum()
|
||||
},
|
||||
methods: {
|
||||
Uppop(id) {
|
||||
this.dialogTableVisible = true
|
||||
this.idinfo = id
|
||||
},
|
||||
sumbit(formName) {
|
||||
this.$refs[formName].validate(async (valid) => {
|
||||
if (valid) {
|
||||
this.dialogTableVisible = false
|
||||
const res = await paidAmount({
|
||||
id: this.idinfo,
|
||||
paidAmount: this.ruleForm.montey,
|
||||
payType: this.ruleForm.payType,
|
||||
remark: this.ruleForm.remark
|
||||
})
|
||||
this.$message({ type: 'success', message: '付款成功!' });
|
||||
this.ruleForm.montey = ''
|
||||
this.ruleForm.payType = ''
|
||||
this.getTableData()
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
async getTableData() {
|
||||
this.tableData.loading = true
|
||||
try {
|
||||
@@ -320,14 +194,13 @@ export default {
|
||||
size: this.tableData.size,
|
||||
sort: this.tableData.sort,
|
||||
purveyorId: this.$route.query.purveyorId,
|
||||
status: this.query.status,
|
||||
type: this.query.type,
|
||||
createdAt: this.query.createdAt,
|
||||
status: this.query.type,
|
||||
type: 'purveyor',
|
||||
createdAt: this.query.createdAt
|
||||
})
|
||||
this.tableData.loading = false
|
||||
this.tableData.list = res.content
|
||||
this.tableData.total = res.totalElements
|
||||
this.tbShopPurveyorTransactSum()
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
@@ -337,8 +210,6 @@ export default {
|
||||
this.query.time = 'all'
|
||||
this.query.createdAt = []
|
||||
this.tableData.page = 0;
|
||||
this.query.type = ''
|
||||
this.query.status = ''
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页回调
|
||||
@@ -346,6 +217,14 @@ export default {
|
||||
this.tableData.page = e - 1
|
||||
this.getTableData()
|
||||
},
|
||||
async dictDetail() {
|
||||
const { content } = await dictDetail({
|
||||
dictName: 'purveyor_transact_status',
|
||||
size: 100,
|
||||
page: 0
|
||||
})
|
||||
this.types = content
|
||||
},
|
||||
// 选择时间
|
||||
timeChange(e) {
|
||||
this.query.createdAt = []
|
||||
@@ -380,41 +259,8 @@ export default {
|
||||
this.selectCount = selection.length
|
||||
},
|
||||
async tbShopPurveyorTransactSum() {
|
||||
this.info = await tbShopPurveyorTransactSum({ purveyorId: this.$route.query.purveyorId, type: this.query.type })
|
||||
},
|
||||
//记录分页
|
||||
paginationChangetype(e) {
|
||||
this.tableDatatype.page = e - 1
|
||||
this.getTableDatatype()
|
||||
},
|
||||
// 记录重置查询
|
||||
resetHandletype() {
|
||||
this.querytypedialogshow.type = ''
|
||||
this.tableData.page = 0
|
||||
this.getTableDatatype()
|
||||
},
|
||||
typedialogshowsumbit(ID) {
|
||||
this.querytypedialogshow.id = ID
|
||||
this.getTableDatatype()
|
||||
},
|
||||
//记录列表
|
||||
async getTableDatatype() {
|
||||
this.tableDatatype.loading = true
|
||||
try {
|
||||
const res = await tbShopPurveyorTransacttransactPayInfos({
|
||||
// page: this.tableDatatype.page,
|
||||
// size: this.tableDatatype.size,
|
||||
type: this.querytypedialogshow.type,
|
||||
id: this.querytypedialogshow.id
|
||||
})
|
||||
this.typedialogshow = true
|
||||
this.tableDatatype.loading = false
|
||||
this.tableDatatype.data = res
|
||||
this.tableDatatype.total = res.totalElements
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
this.info = await tbShopPurveyorTransactSum({ purveyorId: this.$route.query.purveyorId, type: 'purveyor' })
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -502,8 +348,3 @@ export default {
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- <style>
|
||||
/deep/ .el-dialog__body{
|
||||
padding-right: 20px!important;
|
||||
}
|
||||
</style> -->
|
||||
@@ -5,8 +5,7 @@
|
||||
<el-input v-model="query.name" clearable placeholder="供应商" @keyup.enter.native="getTableData"
|
||||
style="width: 200px;" />
|
||||
<el-select v-model="query.type" placeholder="付款状态">
|
||||
<el-option label="待支付" value="0"></el-option>
|
||||
<el-option label="已完结" value="1"></el-option>
|
||||
<el-option :label="item.label" :value="item.value" v-for="item in types" :key="item.id"></el-option>
|
||||
</el-select>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
@@ -38,7 +37,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="上笔进货日期" prop="lastTransactAt">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.lastTransactAt && dayjs(scope.row.lastTransactAt).format('YYYY-MM-DD HH:mm:ss') }}
|
||||
{{ dayjs(scope.row.lastTransactAt).format('YYYY-MM-DD HH:mm:ss') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="80">
|
||||
@@ -51,14 +50,13 @@
|
||||
</el-table>
|
||||
</div>
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
||||
@current-change="paginationChange" @size-change="pagesizeChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
@current-change="paginationChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import dayjs from 'dayjs'
|
||||
import { tbShopPurveyorTransactGet } from '@/api/invoicing'
|
||||
import { tbShopPurveyorTransactGet, dictDetail } from '@/api/invoicing'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -79,6 +77,7 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.dictDetail()
|
||||
this.getTableData()
|
||||
},
|
||||
methods: {
|
||||
@@ -113,9 +112,13 @@ export default {
|
||||
this.tableData.page = e - 1
|
||||
this.getTableData()
|
||||
},
|
||||
pagesizeChange(e) {
|
||||
this.tableData.size = e
|
||||
this.getTableData()
|
||||
async dictDetail() {
|
||||
const { content } = await dictDetail({
|
||||
dictName: 'purveyor_transact_status',
|
||||
size: 100,
|
||||
page: 0
|
||||
})
|
||||
this.types = content
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<div class="app-container">
|
||||
<div class="head-container">
|
||||
<div class="filter_wrap">
|
||||
<el-input v-model="query.name" size="small" clearable placeholder="供应商"
|
||||
@keyup.enter.native="getTableData" style="width: 200px;" />
|
||||
<el-input v-model="query.name" size="small" clearable placeholder="供应商" @keyup.enter.native="getTableData"
|
||||
style="width: 200px;" />
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
</div>
|
||||
@@ -32,8 +32,7 @@
|
||||
</el-table>
|
||||
</div>
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
||||
@current-change="paginationChange" @size-change="pagesizeChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
@current-change="paginationChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
<addSupplier ref="addSupplier" @success="getTableData" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -101,10 +100,6 @@ export default {
|
||||
this.tableData.page = 0;
|
||||
this.getTableData()
|
||||
},
|
||||
pagesizeChange(e) {
|
||||
this.tableData.size = e
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1
|
||||
|
||||
@@ -5,17 +5,6 @@
|
||||
<h3 class="title">
|
||||
银收客后台管理
|
||||
</h3>
|
||||
<el-form-item>
|
||||
<el-radio-group v-model="loginForm.loginType">
|
||||
<el-radio-button label="merchant">商户</el-radio-button>
|
||||
<el-radio-button label="staff">员工</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item prop="merchantName" v-if="loginForm.loginType == 'staff'">
|
||||
<el-input v-model="loginForm.merchantName" type="text" auto-complete="off" placeholder="商户号">
|
||||
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="username">
|
||||
<el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
|
||||
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
||||
@@ -38,11 +27,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item>
|
||||
<el-checkbox v-model="loginForm.rememberMe">
|
||||
<el-checkbox v-model="loginForm.rememberMe" style="margin:0 0 25px 0;">
|
||||
记住我
|
||||
</el-checkbox>
|
||||
</el-form-item> -->
|
||||
<el-form-item style="width:100%;">
|
||||
<el-button :loading="loading" size="medium" type="primary" style="width:100%;"
|
||||
@click.native.prevent="handleLogin">
|
||||
@@ -79,15 +66,12 @@ export default {
|
||||
password: '',
|
||||
rememberMe: false,
|
||||
code: '',
|
||||
uuid: '',
|
||||
merchantName: '',
|
||||
loginType: 'merchant'
|
||||
uuid: ''
|
||||
},
|
||||
loginRules: {
|
||||
username: [{ required: true, trigger: 'blur', message: '用户名不能为空' }],
|
||||
password: [{ required: true, trigger: 'blur', message: '密码不能为空' }],
|
||||
code: [{ required: true, trigger: 'change', message: '验证码不能为空' }],
|
||||
merchantName: [{ required: true, trigger: 'change', message: '商户号不能为空' }]
|
||||
code: [{ required: true, trigger: 'change', message: '验证码不能为空' }]
|
||||
},
|
||||
loading: false,
|
||||
redirect: undefined
|
||||
@@ -111,10 +95,10 @@ export default {
|
||||
created() {
|
||||
// 获取验证码
|
||||
this.getCode()
|
||||
// // 获取用户名密码等Cookie
|
||||
// this.getCookie()
|
||||
// // token 过期提示
|
||||
// this.point()
|
||||
// 获取用户名密码等Cookie
|
||||
this.getCookie()
|
||||
// token 过期提示
|
||||
this.point()
|
||||
},
|
||||
methods: {
|
||||
getCode() {
|
||||
@@ -135,39 +119,32 @@ export default {
|
||||
username: username === undefined ? this.loginForm.username : username,
|
||||
password: password,
|
||||
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe),
|
||||
code: '',
|
||||
merchantName: '',
|
||||
loginType: 'merchant'
|
||||
code: ''
|
||||
}
|
||||
},
|
||||
handleLogin() {
|
||||
this.$refs.loginForm.validate(valid => {
|
||||
// const user = {
|
||||
// username: this.loginForm.username,
|
||||
// password: this.loginForm.password,
|
||||
// rememberMe: this.loginForm.rememberMe,
|
||||
// code: this.loginForm.code,
|
||||
// uuid: this.loginForm.uuid,
|
||||
// merchantName: this.loginForm.merchantName,
|
||||
// loginType: this.loginForm.loginType
|
||||
// }
|
||||
// if (user.password !== this.cookiePass) {
|
||||
// user.password = encrypt(user.password)
|
||||
// }
|
||||
const user = {
|
||||
username: this.loginForm.username,
|
||||
password: this.loginForm.password,
|
||||
rememberMe: this.loginForm.rememberMe,
|
||||
code: this.loginForm.code,
|
||||
uuid: this.loginForm.uuid
|
||||
}
|
||||
if (user.password !== this.cookiePass) {
|
||||
user.password = encrypt(user.password)
|
||||
}
|
||||
if (valid) {
|
||||
this.loading = true
|
||||
// if (user.rememberMe) {
|
||||
// Cookies.set('username', user.username, { expires: Config.passCookieExpires })
|
||||
// Cookies.set('password', user.password, { expires: Config.passCookieExpires })
|
||||
// Cookies.set('rememberMe', user.rememberMe, { expires: Config.passCookieExpires })
|
||||
// } else {
|
||||
// Cookies.remove('username')
|
||||
// Cookies.remove('password')
|
||||
// Cookies.remove('rememberMe')
|
||||
// }
|
||||
// console.log(user);
|
||||
const user = { ...this.loginForm }
|
||||
user.password = encrypt(user.password)
|
||||
if (user.rememberMe) {
|
||||
Cookies.set('username', user.username, { expires: Config.passCookieExpires })
|
||||
Cookies.set('password', user.password, { expires: Config.passCookieExpires })
|
||||
Cookies.set('rememberMe', user.rememberMe, { expires: Config.passCookieExpires })
|
||||
} else {
|
||||
Cookies.remove('username')
|
||||
Cookies.remove('password')
|
||||
Cookies.remove('rememberMe')
|
||||
}
|
||||
this.$store.dispatch('Login', user).then(() => {
|
||||
this.loading = false
|
||||
this.$router.push({ path: this.redirect || '/' })
|
||||
@@ -240,12 +217,10 @@ export default {
|
||||
text-align: center;
|
||||
color: #bfbfbf;
|
||||
}
|
||||
|
||||
.code_wrap {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.login-code {
|
||||
width: 33%;
|
||||
display: inline-block;
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="foot">退款:¥-{{ item.orderAmount }}</div>
|
||||
<div class="foot">退款:¥-{{ item.refundAmount }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
@@ -1,296 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="head-container">
|
||||
<el-form :model="query" inline>
|
||||
<el-form-item>
|
||||
<el-input v-model="query.orderNo" placeholder="订单号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select v-model="query.payType" placeholder="支付类型">
|
||||
<el-option label="微信支付" value="wechatPay" />
|
||||
<el-option label="支付宝支付" value="aliPay" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-input v-model="query.phone" placeholder="联系电话"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-input v-model="query.proName" placeholder="商品名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select v-model="query.status" placeholder="状态">
|
||||
<el-option label="待付款" value="unpaid" />
|
||||
<el-option label="待使用" value="unused" />
|
||||
<el-option label="已完成" value="closed" />
|
||||
<el-option label="退款中" value="refunding" />
|
||||
<el-option label="已退款" value="refund" />
|
||||
<el-option label="已取消" value="cancelled" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-date-picker v-model="query.createdAt" type="daterange" range-separator="至"
|
||||
start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']"
|
||||
value-format="yyyy-MM-dd HH:mm:ss">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.data" v-loading="tableData.loading">
|
||||
<el-table-column label="订单号" prop="orderNo"></el-table-column>
|
||||
<el-table-column label="团购卷名称" prop="proName"></el-table-column>
|
||||
<el-table-column label="到期日期" prop="expDate"></el-table-column>
|
||||
<el-table-column label="创建时间" prop="createTime"></el-table-column>
|
||||
<el-table-column label="下单数量" prop="number"></el-table-column>
|
||||
<el-table-column label="已退数量" prop="refundNumber"></el-table-column>
|
||||
<el-table-column label="订单金额" prop="orderAmount">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.orderAmount }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="支付金额" prop="payAmount">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.payAmount }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="支付方式" prop="payType">
|
||||
<template v-slot="scope">
|
||||
{{ payF(scope.row.payType) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="下单人电话" prop="phone"></el-table-column>
|
||||
<el-table-column label="是否支持退款" prop="refundAble">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.refundAble ? "是" : "否" }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" prop="remark"></el-table-column>
|
||||
<el-table-column label="状态" prop="status">
|
||||
<template v-slot="scope">
|
||||
<el-tag :type="statusF(scope.row.status)">
|
||||
{{ scope.row.status }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="交易日期" prop="tradeDay"></el-table-column>
|
||||
<el-table-column label="核销员" prop="verifier"></el-table-column>
|
||||
<!-- <el-table-column label="操作" width="100">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" icon="el-icon-edit" @click="showRefund(scope.row)"
|
||||
:disabled="!scope.row.refundAble">退款</el-button>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
||||
@current-change="paginationChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
</div>
|
||||
<el-dialog title="退款" :visible.sync="showDialog" width="400px">
|
||||
<el-form ref="refundForm" :model="refundForm" :rules="refundFormRules" label-position="top">
|
||||
<el-form-item label="退单数" prop="num">
|
||||
<el-select v-model="refundForm.num" placeholder="请选择退单数" style="width: 100%;"
|
||||
@change="refundNumChange">
|
||||
<el-option :label="item" :value="item" v-for="item in refundNumList" :key="item"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="退单金额">
|
||||
<el-input v-model="refundForm.refundAmount" disabled placeholder="请选择退单数"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="退款原因">
|
||||
<el-input v-model="refundForm.refundReason" type="textarea" placeholder="请输入退款原因"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="showDialog = false">取消</el-button>
|
||||
<el-button type="primary" :loading="refundLoading" @click="refundConfirm">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { tbGroupOrderInfo, returnGpOrder } from "@/api/order";
|
||||
import dayjs from "dayjs";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
query: {
|
||||
orderNo: "",
|
||||
payType: "",
|
||||
phone: "",
|
||||
proName: "",
|
||||
status: "",
|
||||
createTime: []
|
||||
},
|
||||
resetQuery: "",
|
||||
tableData: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 10,
|
||||
loading: false,
|
||||
total: 0
|
||||
},
|
||||
payTypes: [
|
||||
{
|
||||
value: "wechatPay",
|
||||
label: "微信支付"
|
||||
},
|
||||
{
|
||||
value: "aliPay",
|
||||
label: "支付宝支付"
|
||||
}
|
||||
],
|
||||
statusList: [
|
||||
{
|
||||
value: "unpaid",
|
||||
label: "待付款",
|
||||
type: "warning"
|
||||
},
|
||||
{
|
||||
value: "unused",
|
||||
label: "待使用",
|
||||
type: "primary"
|
||||
},
|
||||
{
|
||||
value: "closed",
|
||||
label: "已完成",
|
||||
type: "success"
|
||||
},
|
||||
{
|
||||
value: "refunding",
|
||||
label: "退款中",
|
||||
type: "warning"
|
||||
},
|
||||
{
|
||||
value: "refund",
|
||||
label: "已退款",
|
||||
type: "default"
|
||||
},
|
||||
{
|
||||
value: "cancelled",
|
||||
label: "已取消",
|
||||
type: "danger"
|
||||
}
|
||||
],
|
||||
row: '',
|
||||
showDialog: false,
|
||||
refundNumList: [],
|
||||
refundLoading: false,
|
||||
refundForm: {
|
||||
num: '',
|
||||
orderId: '',
|
||||
refundAmount: '',
|
||||
refundDesc: '',
|
||||
refundReason: ''
|
||||
},
|
||||
refundFormRules: {
|
||||
num: [
|
||||
{
|
||||
required: true,
|
||||
message: ' ',
|
||||
trigger: 'change'
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
filters: {
|
||||
timeFilter(s) {
|
||||
return dayjs(s).format("YYYY-MM-DD HH:mm:ss");
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getTableData();
|
||||
this.resetQuery = { ...this.query };
|
||||
},
|
||||
methods: {
|
||||
// 提交退单
|
||||
refundConfirm() {
|
||||
this.$refs.refundForm.validate(async valid => {
|
||||
if (valid) {
|
||||
try {
|
||||
this.refundLoading = true
|
||||
const res = await returnGpOrder(this.refundForm)
|
||||
this.refundLoading = false
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: `退单成功`,
|
||||
type: 'success'
|
||||
});
|
||||
this.showDialog = false
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
this.refundLoading = false
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 计算退单金额
|
||||
refundNumChange(e) {
|
||||
this.refundForm.refundAmount = Math.floor(this.row.orderAmount / e * 100) / 100
|
||||
},
|
||||
// 显示退款
|
||||
showRefund(row) {
|
||||
this.row = row
|
||||
let arr = []
|
||||
for (let i = 1; i <= row.number - row.refundNumber; i++) {
|
||||
arr.push(i)
|
||||
}
|
||||
this.refundNumList = arr
|
||||
this.refundForm.orderId = row.id
|
||||
this.showDialog = true
|
||||
},
|
||||
payF(p) {
|
||||
return p && this.payTypes.find(item => item.value == p).label;
|
||||
},
|
||||
statusF(t) {
|
||||
return t && this.statusList.find(item => item.label == t).type;
|
||||
},
|
||||
// 切换状态
|
||||
async statusChange(e, row) {
|
||||
try {
|
||||
this.tableData.loading = true;
|
||||
const data = { ...row };
|
||||
data.status = e;
|
||||
await tbPrintMachine(data, "put");
|
||||
this.getTableData();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
this.tableData.loading = false;
|
||||
}
|
||||
},
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.query = { ...this.resetQuery };
|
||||
this.getTableData();
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1;
|
||||
this.getTableData();
|
||||
},
|
||||
// 获取列表
|
||||
async getTableData() {
|
||||
this.tableData.loading = true;
|
||||
try {
|
||||
const res = await tbGroupOrderInfo({
|
||||
...this.query,
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
sort: "id"
|
||||
});
|
||||
this.tableData.loading = false;
|
||||
this.tableData.data = res.content;
|
||||
this.tableData.total = res.totalElements;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -10,7 +10,11 @@
|
||||
<el-form-item label="订单状态">
|
||||
<el-radio-group v-model="query.status">
|
||||
<el-radio-button label="">全部</el-radio-button>
|
||||
<el-radio-button :label="item.key" v-for="item in orderEnum.status" :key="item.key">
|
||||
<el-radio-button
|
||||
:label="item.key"
|
||||
v-for="item in orderEnum.status"
|
||||
:key="item.key"
|
||||
>
|
||||
{{ item.label }}
|
||||
</el-radio-button>
|
||||
</el-radio-group>
|
||||
@@ -18,7 +22,11 @@
|
||||
<el-form-item label="支付方式">
|
||||
<el-radio-group v-model="query.payType">
|
||||
<el-radio-button label="">全部</el-radio-button>
|
||||
<el-radio-button :label="item.payType" v-for="item in payTypes" :key="item.payType">
|
||||
<el-radio-button
|
||||
:label="item.payType"
|
||||
v-for="item in payTypes"
|
||||
:key="item.payType"
|
||||
>
|
||||
{{ item.payName }}
|
||||
</el-radio-button>
|
||||
</el-radio-group>
|
||||
@@ -34,40 +42,40 @@
|
||||
<el-radio-button label="month">本月</el-radio-button>
|
||||
<el-radio-button label="custom">自定义</el-radio-button>
|
||||
</el-radio-group>
|
||||
<el-date-picker v-model="query.createdAt" type="daterange" range-separator="至" start-placeholder="开始日期"
|
||||
end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" value-format="yyyy-MM-dd HH:mm:ss"
|
||||
v-if="timeValue == 'custom'">
|
||||
<el-date-picker
|
||||
v-model="query.createdAt"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="['00:00:00', '23:59:59']"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
v-if="timeValue == 'custom'"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="订单号">
|
||||
<el-input
|
||||
v-model="query.orderNo"
|
||||
placeholder="请输入订单号"
|
||||
style="width: 300px;"
|
||||
></el-input>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="商品名称">
|
||||
<el-input
|
||||
v-model="query.productName"
|
||||
placeholder="请输入商品名称"
|
||||
style="width: 300px;"
|
||||
></el-input>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
<el-button icon="el-icon-download" v-loading="downloadLoading" @click="downloadHandle">
|
||||
<el-button
|
||||
icon="el-icon-download"
|
||||
v-loading="downloadLoading"
|
||||
@click="downloadHandle"
|
||||
>
|
||||
<span v-if="!downloadLoading">导出Excel</span>
|
||||
<span v-else>下载中...</span>
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<div class="collect_wrap">
|
||||
<!-- <div class="item">
|
||||
<div class="item">
|
||||
<div class="icon_wrap" style="--bg-color:#C978EE">
|
||||
<i class="icon el-icon-s-goods"></i>
|
||||
</div>
|
||||
@@ -75,7 +83,7 @@
|
||||
<div class="m">¥{{ payCountTotal }}</div>
|
||||
<div class="t">总金额</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="item" v-for="item in payCountList" :key="item.payType">
|
||||
<div class="icon_wrap" style="--bg-color:#fff">
|
||||
<el-image class="img" :src="item.icon"></el-image>
|
||||
@@ -104,12 +112,22 @@
|
||||
<el-table-column label="商品信息">
|
||||
<template v-slot="scope">
|
||||
<div class="goods_info">
|
||||
<div class="row" v-for="item in scope.row.detailList" :key="item.id">
|
||||
<div
|
||||
class="row"
|
||||
v-for="item in scope.row.detailList"
|
||||
:key="item.id"
|
||||
>
|
||||
<el-image :src="item.productImg" class="cover" lazy></el-image>
|
||||
<div class="info">
|
||||
<div class="name">
|
||||
{{ item.productName }}
|
||||
<span class="refund" v-if="item.refundNumber">(退 - {{ item.refundNumber }})</span>
|
||||
<span
|
||||
class="refund"
|
||||
v-if="
|
||||
item.status == 'refunding' || item.status == 'refund'
|
||||
"
|
||||
>(退 - {{ item.num }})</span
|
||||
>
|
||||
</div>
|
||||
<div class="sku">{{ item.productSkuName }}</div>
|
||||
</div>
|
||||
@@ -117,23 +135,27 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="台桌号" prop="tableName"></el-table-column>
|
||||
<el-table-column label="订单金额">
|
||||
<template v-slot="scope">
|
||||
<div>{{ scope.row.orderType | orderTypeFilter }}</div>
|
||||
<div class="refund" v-if="
|
||||
scope.row.orderType == 'return'
|
||||
">
|
||||
退款:-¥{{ scope.row.orderAmount }}
|
||||
<div
|
||||
class="refund"
|
||||
v-if="
|
||||
scope.row.status == 'refunding' || scope.row.status == 'refund'
|
||||
"
|
||||
>
|
||||
退款:-¥{{ scope.row.refundAmount }}
|
||||
</div>
|
||||
<div v-else>¥{{ scope.row.orderAmount }}</div>
|
||||
<div>¥{{ scope.row.orderAmount }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态">
|
||||
<template v-slot="scope">
|
||||
<template v-if="
|
||||
<template
|
||||
v-if="
|
||||
scope.row.status == 'refund' && scope.row.orderType != 'return'
|
||||
">
|
||||
"
|
||||
>
|
||||
<el-tag type="primary">已完成</el-tag>
|
||||
</template>
|
||||
<template v-else>
|
||||
@@ -146,7 +168,6 @@
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" prop="remark"></el-table-column>
|
||||
<el-table-column label="创建时间">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.createdAt | timeFilter }}
|
||||
@@ -154,15 +175,22 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="100">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" @click="$refs.orderDetail.show(scope.row)">详情</el-button>
|
||||
<el-button type="text" @click="$refs.orderDetail.show(scope.row)"
|
||||
>详情</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
||||
@current-change="paginationChange" @size-change="sizeChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
<el-pagination
|
||||
:total="tableData.total"
|
||||
:current-page="tableData.page + 1"
|
||||
:page-size="tableData.size"
|
||||
@current-change="paginationChange"
|
||||
@size-change="sizeChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
></el-pagination>
|
||||
</div>
|
||||
<orderDetail ref="orderDetail" />
|
||||
</div>
|
||||
@@ -191,8 +219,7 @@ export default {
|
||||
status: "",
|
||||
payType: "",
|
||||
orderNo: "",
|
||||
createdAt: [],
|
||||
productName:''
|
||||
createdAt: []
|
||||
},
|
||||
tableData: {
|
||||
data: [],
|
||||
@@ -206,7 +233,6 @@ export default {
|
||||
payCountTotal: 0
|
||||
};
|
||||
},
|
||||
|
||||
filters: {
|
||||
orderTypeFilter(t) {
|
||||
if (t) {
|
||||
@@ -234,22 +260,9 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (this.$route.query.tableName) {
|
||||
this.query.tableName = this.$route.query.tableName
|
||||
}
|
||||
if(this.$route.query.orderNo){
|
||||
this.query.orderNo = this.$route.query.orderNo
|
||||
}
|
||||
this.resetQuery = { ...this.query };
|
||||
this.tbShopPayTypeGet();
|
||||
this.getTableData();
|
||||
// 从商品库存-库存记录-点击订单号跳转过来
|
||||
if (this.$route.query.orderNo) {
|
||||
this.query.orderNo = this.$route.query.orderNo
|
||||
setTimeout(() => {
|
||||
this.getTableData();
|
||||
}, 200);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 获取订单汇总
|
||||
@@ -305,13 +318,11 @@ export default {
|
||||
this.tableData.loading = true;
|
||||
try {
|
||||
this.payCount();
|
||||
const productName=this.query.productName.replace(/\s+/g,'')
|
||||
const res = await tbOrderInfoData({
|
||||
page: this.tableData.page,
|
||||
pageSize: this.tableData.size,
|
||||
orderType: this.orderType,
|
||||
...this.query,
|
||||
productName
|
||||
...this.query
|
||||
});
|
||||
this.tableData.loading = false;
|
||||
this.tableData.data = res.content;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
||||
<el-button type="primary" icon="el-icon-plus" @click="$refs.addClassifyRef.show()">添加分类</el-button>
|
||||
<addClassify ref="addClassifyRef" @success="getTableData" />
|
||||
</div>
|
||||
<div class="head-container" id="table_drag">
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.list" v-loading="tableData.loading" row-key="id"
|
||||
:tree-props="{ children: 'childrenList' }">
|
||||
<el-table-column label="排序" prop="sort" sortable width="100"></el-table-column>
|
||||
@@ -56,9 +56,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import Sortable from 'sortablejs'
|
||||
import addClassify from './components/addClassify'
|
||||
import { tbShopCategoryGet, tbShopCategoryDelete, tbShopCategoryPost, upCategorySort } from '@/api/shop'
|
||||
import { tbShopCategoryGet, tbShopCategoryDelete, tbShopCategoryPost } from '@/api/shop'
|
||||
export default {
|
||||
components: {
|
||||
addClassify
|
||||
@@ -76,37 +75,8 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.getTableData()
|
||||
// this.$nextTick(() => {
|
||||
// this.tableDrag()
|
||||
// })
|
||||
},
|
||||
methods: {
|
||||
//表格拖拽
|
||||
// tableDrag() {
|
||||
// const el = document.querySelector('#table_drag .el-table__body-wrapper tbody')
|
||||
// new Sortable(el, {
|
||||
// animation: 150,
|
||||
// onEnd: async e => {
|
||||
// console.log('拖拽结束===', e);
|
||||
// return
|
||||
// if (e.oldIndex == e.newIndex) return
|
||||
// let oid = this.tableData.list[e.oldIndex].id
|
||||
// let nid = this.tableData.list[e.newIndex].id
|
||||
// let ids = this.tableData.list.map(item => item.id)
|
||||
// let isParent = this.tableData.list[e.oldIndex].pid ? 1 : 0
|
||||
// try {
|
||||
// await upCategorySort({
|
||||
// strId: oid,
|
||||
// endId: nid,
|
||||
// ids: ids
|
||||
// })
|
||||
// await this.getTableData()
|
||||
// } catch (error) {
|
||||
// console.log(error);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// },
|
||||
// 状态切换
|
||||
async showChange(e, row) {
|
||||
try {
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<el-form-item label="开关">
|
||||
<el-switch v-model="form.isShow" :active-value="1" :inactive-value="0"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" v-if="form.id">
|
||||
<el-form-item label="排序">
|
||||
<el-input-number v-model="form.sort" controls-position="right" :min="0"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -92,7 +92,7 @@ export default {
|
||||
show(obj) {
|
||||
// console.log(obj)
|
||||
this.dialogVisible = true
|
||||
if (obj && obj.pid) {
|
||||
if (obj.pid) {
|
||||
this.form.pid = obj.pid
|
||||
}
|
||||
if (obj && obj.id) {
|
||||
|
||||
@@ -27,37 +27,12 @@
|
||||
<el-radio :label="0">禁用</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="售卖时间管控" v-if="form.id">
|
||||
<el-radio-group v-model="form.useTime">
|
||||
<el-radio :label="1">启用</el-radio>
|
||||
<el-radio :label="0">禁用</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="" v-if="form.useTime == 1">
|
||||
<!-- <el-time-picker is-range v-model="form.saleTime" value-format="HH:mm" format="HH:mm"
|
||||
:picker-options="pickerOptions" range-separator="至" start-placeholder="开始时间"
|
||||
end-placeholder="结束时间" placeholder="选择时间范围">
|
||||
</el-time-picker> -->
|
||||
|
||||
<el-time-picker placeholder="起始时间" v-model="form.saleStartTime" :picker-options="{
|
||||
selectableRange: '00:00:00 - 23:59:59',
|
||||
format: 'HH:mm'
|
||||
}" format="HH:mm" value-format="HH:mm">
|
||||
</el-time-picker>
|
||||
<el-time-picker placeholder="结束时间" v-model="form.saleEndTime" :picker-options="{
|
||||
selectableRange: '00:00:00 - 23:59:59',
|
||||
}" format="HH:mm" value-format="HH:mm">
|
||||
</el-time-picker>
|
||||
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="分组排序" v-if="form.id">
|
||||
<el-form-item label="分组排序">
|
||||
<el-input-number v-model="form.sort" controls-position="right" :min="0"></el-input-number>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="quxiaodialogVisible">取 消</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="onSubmitHandle">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
@@ -82,19 +57,8 @@ export default {
|
||||
isShow: 1,
|
||||
sort: 0,
|
||||
productIds: [],
|
||||
saleTime: [],
|
||||
useTime: 0,
|
||||
shopId: localStorage.getItem('shopId')
|
||||
},
|
||||
pickerOptions: {
|
||||
selectableRange: '00:00:00 - 23:59:59'
|
||||
// disabledDate(time) {
|
||||
// // return time.getTime() < Date.now() - 8.64e7;//如果没有后面的-8.64e7就是不可以选择今天的
|
||||
// // return time.getTime() < Date.now(); //只可以选择今天之后
|
||||
// return time.getTime() < Date.now() - 8.64e7;//只可以选择今天之后包括今天
|
||||
|
||||
// }
|
||||
},
|
||||
rules: {
|
||||
name: [
|
||||
{
|
||||
@@ -102,24 +66,12 @@ export default {
|
||||
message: ' ',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
saleTime: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
]
|
||||
},
|
||||
productIds: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
quxiaodialogVisible() {
|
||||
this.dialogVisible = false
|
||||
this.$emit('success', null)
|
||||
|
||||
},
|
||||
slectShop(res) {
|
||||
if (this.productIds.length) {
|
||||
res.map(async item => {
|
||||
@@ -147,7 +99,6 @@ export default {
|
||||
this.loading = true
|
||||
try {
|
||||
this.form.productIds = this.productIds.map(item => item.id);
|
||||
|
||||
let res = null
|
||||
if (!this.form.id) {
|
||||
await tbProductGroupPost(this.form)
|
||||
@@ -177,18 +128,12 @@ export default {
|
||||
}
|
||||
},
|
||||
show(obj) {
|
||||
// if()
|
||||
this.form.useTime = 0
|
||||
if (obj && obj.id) {
|
||||
this.form = obj
|
||||
this.form.id = obj.id
|
||||
this.form.isShow = obj.isShow
|
||||
this.form.name = obj.name
|
||||
this.form.sort = obj.sort
|
||||
this.form.productIds = obj.productIds
|
||||
// if (obj.saleStartTime != null) {
|
||||
// this.$set(this.form, 'saleTime', [obj.saleStartTime, obj.saleEndTime])
|
||||
// }
|
||||
this.getProduts()
|
||||
}
|
||||
this.dialogVisible = true
|
||||
@@ -200,7 +145,6 @@ export default {
|
||||
this.form.isShow = 1
|
||||
this.form.name = ''
|
||||
this.form.sort = 0
|
||||
this.form.id = null
|
||||
this.form.productIds = []
|
||||
this.productIds = []
|
||||
}
|
||||
|
||||
@@ -1,234 +0,0 @@
|
||||
<template>
|
||||
<div >
|
||||
<el-dialog title="选择图片" :visible.sync="dialogVisible" width="1000px">
|
||||
<el-container>
|
||||
<el-aside style="background-color: #fff;" width="150px">
|
||||
<ul style="padding-left: 0;margin: 0;">
|
||||
<li style="cursor: pointer;" v-for="item in options" :key="item.id"
|
||||
:class="[activedata == item.id ? 'activedata' : '']" @click="changeEvent(item.id)">
|
||||
{{ item.name }} <span style="font-size: 12px;">({{ item.count }})</span>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="uplocation" :class="[activedata == -1 ? 'activedata' : '']" @click="uplocation">我的图片
|
||||
</div>
|
||||
</el-aside>
|
||||
<el-main>
|
||||
<imageComponent @onSelectImage="onSelectImage" @getList="getList" :activedata="activedata"
|
||||
:list='dataImages'>
|
||||
</imageComponent>
|
||||
<mypagination :total="total" @gopageEvent="handleCurrentChange"></mypagination>
|
||||
<!-- <el-pagination style="position: absolute;right: 60px;" layout="prev, pager, next ,jumper" background :total="total" :page-size="pageSize"
|
||||
@current-change="handleCurrentChange">
|
||||
</el-pagination> -->
|
||||
</el-main>
|
||||
</el-container>
|
||||
<div style="text-align: center">
|
||||
<el-button type="success" @click="sumbit">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- <el-select v-model="value" placeholder="请选择" @change="changeEvent">
|
||||
<el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id">
|
||||
<span style="float: left">{{ item.name }}</span>
|
||||
<template v-if="item.id != '681'">
|
||||
<template v-if="item.id != '682'">
|
||||
<template v-if="item.id != '699'">
|
||||
<span style="float: right; color: #8492a6; font-size: 13px"><i class="el-icon-error "
|
||||
@click="deleteType(item.id)"></i></span>
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
</el-option>
|
||||
</el-select> -->
|
||||
<!-- <el-button type="primary" @click="dialogTableVisibles = true">新增类型</el-button> -->
|
||||
<!-- <el-button type="primary" @click="showUpload = true">新增图片</el-button> -->
|
||||
|
||||
<!-- 新增类型 -->
|
||||
<!-- <el-dialog title="新增类型" :visible.sync="dialogTableVisibles">
|
||||
<el-input v-model="typedata" placeholder="请输入类型" autocomplete="off"></el-input>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogTableVisibles = false">取 消</el-button>
|
||||
<el-button type="primary" @click="addtype">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog> -->
|
||||
<!-- 新增图片 -->
|
||||
<!-- <template v-if="showUpload">
|
||||
<el-dialog :visible.sync="showUpload" :close-on-click-modal="false" append-to-body width="1000px"
|
||||
@close="showUpload = false">
|
||||
<el-upload :before-remove="handleBeforeRemove" list-type="picture-card" :on-success="handleSuccess"
|
||||
:file-list="fileList" :headers="headers" :action="qiNiuUploadApi" class="upload-demo" multiple>
|
||||
<i class="el-icon-plus"></i>
|
||||
</el-upload>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="doSubmit">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getcommonCategor, getcommonpicture, storeAddcategory, addImg, delcate } from "@/api/imagesPhp";
|
||||
import { mapGetters } from "vuex";
|
||||
import { getToken } from "@/utils/auth";
|
||||
import imageComponent from './imageComponent.vue'
|
||||
import mypagination from './mypagination'
|
||||
export default {
|
||||
computed: {
|
||||
...mapGetters(["qiNiuUploadApi"])
|
||||
},
|
||||
components: {
|
||||
imageComponent,mypagination
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
dialogTableVisibles: false,
|
||||
selectImage: [],
|
||||
headers: {
|
||||
Authorization: getToken()
|
||||
},
|
||||
files: [],
|
||||
dataImages: [],
|
||||
options: [],
|
||||
fileList: [],
|
||||
value: '',
|
||||
typedata: '',
|
||||
showUpload: false,
|
||||
page: 1,
|
||||
total: 0,
|
||||
// pageSize: 18,
|
||||
activedata: '681'
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getType()
|
||||
},
|
||||
methods: {
|
||||
uplocation() {
|
||||
this.activedata = -1
|
||||
this.page = 1
|
||||
this.dataImages = []
|
||||
// this.pageSize = 17
|
||||
this.getList()
|
||||
},
|
||||
changeEvent(id) {
|
||||
this.page = 1
|
||||
// this.pageSize = 18
|
||||
this.activedata = id
|
||||
this.getList()
|
||||
},
|
||||
handleCurrentChange(i) {
|
||||
this.page = i
|
||||
this.getList()
|
||||
},
|
||||
// 删除类型
|
||||
deleteType(id) {
|
||||
this.$confirm('删除该类型, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
let res = await delcate({
|
||||
id,
|
||||
store_id: localStorage.getItem("shopId"),
|
||||
})
|
||||
this.getType()
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: res.msg
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message.error(res.msg);
|
||||
});
|
||||
},
|
||||
// 刷新列表数据
|
||||
async doSubmit() {
|
||||
this.showUpload = false;
|
||||
let arr = []
|
||||
if (this.files.length) {
|
||||
this.files.forEach(ele => {
|
||||
arr.push({
|
||||
url: ele.response.data[0],
|
||||
name: ele.name
|
||||
})
|
||||
})
|
||||
const res = await addImg({
|
||||
category: this.value,
|
||||
store_id: localStorage.getItem("shopId"),
|
||||
url: arr
|
||||
})
|
||||
if (res.code == 1) {
|
||||
this.getType(this.value)
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
this.files = [];
|
||||
}
|
||||
},
|
||||
handleBeforeRemove(file, fileList) {
|
||||
let index = this.files.findIndex(ele => ele.name == file.name)
|
||||
this.files.splice(index, 1);
|
||||
},
|
||||
handleSuccess(response, file, fileList) {
|
||||
this.files.push(file)
|
||||
},
|
||||
async addtype() {
|
||||
if (this.typedata) {
|
||||
const res = await storeAddcategory({
|
||||
store_id: localStorage.getItem("shopId"),
|
||||
name: this.typedata
|
||||
});
|
||||
if (res.msg == '成功') {
|
||||
this.typedata = ''
|
||||
this.dialogTableVisibles = false
|
||||
this.getType()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
sumbit() {
|
||||
this.dialogVisible = false
|
||||
this.$emit('successEvent', this.selectImage)
|
||||
},
|
||||
show() {
|
||||
this.dialogVisible = true
|
||||
},
|
||||
async getList() {
|
||||
let obj = {
|
||||
category: this.activedata == -1 ? '' : this.activedata,
|
||||
page: this.page,
|
||||
size: 18,
|
||||
store_id: localStorage.getItem("shopId"),
|
||||
}
|
||||
const res = await getcommonpicture(obj);
|
||||
this.dataImages = res.data
|
||||
this.total = res.count
|
||||
},
|
||||
async getType(valueIndex) {
|
||||
const res = await getcommonCategor({
|
||||
store_id: localStorage.getItem("shopId"),
|
||||
});
|
||||
this.options = res.data
|
||||
this.value = valueIndex ? valueIndex : res.data[0].id
|
||||
this.getList()
|
||||
},
|
||||
onSelectImage(d) {
|
||||
this.selectImage = [d]
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.activedata {
|
||||
color: #1890ff;
|
||||
/* background-color: #f6f7f8; */
|
||||
}
|
||||
|
||||
.uplocation {
|
||||
cursor: pointer;
|
||||
/* position: absolute; */
|
||||
/* bottom: 20px; */
|
||||
}
|
||||
</style>
|
||||
@@ -4,7 +4,7 @@
|
||||
<el-form-item label="单位名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="单位名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" v-if="form.id">
|
||||
<el-form-item label="排序">
|
||||
<el-input v-model="form.sort"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
@@ -1,187 +0,0 @@
|
||||
<template>
|
||||
<div style="">
|
||||
<div style="text-align: right;" v-if="activedata == -1">
|
||||
<span style="color: #aaa;">只能上传png、jgp图片</span>
|
||||
<el-button @click="showUpload = true" style="background-color: #f6f7f8;">上传文件</el-button>
|
||||
</div>
|
||||
|
||||
<ul class="ulStyle" :class="[activedata == -1 ? '' : 'heightStyle']">
|
||||
<!-- <li class="upImgStyles" @click="showUpload = true" v-if="activedata == -1">
|
||||
+
|
||||
</li> -->
|
||||
<li v-for="item in list" :key="item.id" class="listyle" :class="[selectList.id == item.id ? 'actives' : '']"
|
||||
@click="clickEvent(item)">
|
||||
<img :src="item.url" style="width: 100px;height: 100px;" alt="">
|
||||
<!-- {{ item.name.substring(0, 6) }} -->
|
||||
</li>
|
||||
</ul>
|
||||
<template v-if="showUpload">
|
||||
<el-dialog :visible.sync="showUpload" :close-on-click-modal="false" append-to-body width="1000px"
|
||||
@close="showUpload = false">
|
||||
<el-upload :before-remove="handleBeforeRemove" :before-upload="beforeUpload" list-type="picture-card"
|
||||
:on-success="handleSuccess" :file-list="fileList" :headers="headers" :action="qiNiuUploadApi"
|
||||
class="upload-demo" multiple>
|
||||
<i class="el-icon-plus"></i>
|
||||
</el-upload>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="doSubmit">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { delimg } from "@/api/imagesPhp";
|
||||
import { getToken } from "@/utils/auth";
|
||||
import { mapGetters } from "vuex";
|
||||
import { getcommonCategor, getcommonpicture, storeAddcategory, addImg, delcate } from "@/api/imagesPhp";
|
||||
|
||||
export default {
|
||||
computed: {
|
||||
...mapGetters(["qiNiuUploadApi"])
|
||||
},
|
||||
props: ['list', 'activedata'],
|
||||
data() {
|
||||
return {
|
||||
showUpload: false,
|
||||
selectList: [],
|
||||
files: [],
|
||||
fileList: [],
|
||||
headers: {
|
||||
Authorization: getToken()
|
||||
},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
async doSubmit() {
|
||||
this.showUpload = false;
|
||||
let arr = []
|
||||
if (this.files.length) {
|
||||
this.files.forEach(ele => {
|
||||
arr.push({
|
||||
url: ele.response.data[0],
|
||||
name: ele.name
|
||||
})
|
||||
})
|
||||
const res = await addImg({
|
||||
category: '',
|
||||
store_id: localStorage.getItem("shopId"),
|
||||
url: arr
|
||||
})
|
||||
if (res.code == 1) {
|
||||
// this.getType(this.value)
|
||||
this.$emit('getList')
|
||||
this.$message.success(res.msg);
|
||||
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
this.files = [];
|
||||
}
|
||||
},
|
||||
handleSuccess(response, file, fileList) {
|
||||
this.files.push(file)
|
||||
},
|
||||
handleBeforeRemove(file, fileList) {
|
||||
let index = this.files.findIndex(ele => ele.name == file.name)
|
||||
this.files.splice(index, 1);
|
||||
},
|
||||
beforeUpload(file) {
|
||||
if (file.type == 'image/png') {
|
||||
} else if (file.type == 'image/jpeg') {
|
||||
} else {
|
||||
this.$message.error('只能上传图片')
|
||||
return false
|
||||
}
|
||||
|
||||
},
|
||||
clickEvent(d) {
|
||||
this.selectList = d
|
||||
this.$emit('onSelectImage', d)
|
||||
},
|
||||
async deleteEvent(id) {
|
||||
let res = await delimg({
|
||||
id,
|
||||
store_id: localStorage.getItem("shopId"),
|
||||
})
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
this.$emit('getList')
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
ul,
|
||||
li {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.show {
|
||||
position: absolute;
|
||||
right: -10px;
|
||||
top: -10px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.listyle:hover>.show {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.buttonstyle {
|
||||
border-radius: 50%;
|
||||
color: #db1616;
|
||||
background-color: #fff;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.ulStyle {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
overflow: auto;
|
||||
height: 402px;
|
||||
}
|
||||
|
||||
.heightStyle {
|
||||
height: 402px;
|
||||
}
|
||||
|
||||
|
||||
.listyle {
|
||||
width: 110px;
|
||||
height: 110px;
|
||||
margin-right: 10px;
|
||||
margin-top: 10px;
|
||||
border: 5px solid #fff;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.listyle:last-child {
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.upImgStyles {
|
||||
cursor: pointer;
|
||||
width: 110px;
|
||||
height: 110px;
|
||||
line-height: 110px;
|
||||
text-align: center;
|
||||
border: 1px dashed #ccc;
|
||||
border-radius: 1%;
|
||||
font-size: 30px;
|
||||
color: #ccc;
|
||||
margin-right: 10px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
|
||||
.actives {
|
||||
border: 5px solid #1890ff;
|
||||
}
|
||||
</style>
|
||||
@@ -1,79 +0,0 @@
|
||||
<template>
|
||||
<div class="mypagination">
|
||||
<i class="el-icon-arrow-left istyle" @click="minuspage" v-show="pgae != 1"></i>
|
||||
<div>
|
||||
<span style="color: #42d885;">
|
||||
{{ pgae }}
|
||||
</span> / {{ totals }}
|
||||
</div>
|
||||
<i class="el-icon-arrow-right istyle" @click="gopage" v-if="pgae != totals"></i>
|
||||
<div style="width: 26px;" v-else></div>
|
||||
<el-input v-model='pagego' class="inputStyle" @input="oninputEvent" />
|
||||
<el-button type="text" @click="gopages">跳转</el-button>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
|
||||
export default {
|
||||
props: ['total'],
|
||||
|
||||
watch: {
|
||||
totals() {
|
||||
this.pgae = 1
|
||||
this.pagego = 1
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
totals() {
|
||||
let pagedata = this.total / 18
|
||||
return pagedata < 0 ? 1 : Math.ceil(pagedata)
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return { pgae: 1, pagego: 1 }
|
||||
},
|
||||
methods: {
|
||||
oninputEvent(d) {
|
||||
let a = d.replace(/[^\d]/g, '')
|
||||
if (a < (this.totals + 1)) {
|
||||
this.pagego = a
|
||||
} else {
|
||||
this.pagego = this.totals
|
||||
}
|
||||
},
|
||||
gopage() {
|
||||
this.$emit('gopageEvent', ++this.pgae)
|
||||
this.pagego = this.pgae
|
||||
},
|
||||
minuspage() {
|
||||
this.$emit('gopageEvent', --this.pgae)
|
||||
this.pagego = this.pgae
|
||||
},
|
||||
gopages() {
|
||||
this.pgae = this.pagego
|
||||
this.$emit('gopageEvent', this.pagego)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.mypagination {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end
|
||||
}
|
||||
|
||||
.istyle {
|
||||
background-color: #f6f7f8;
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
line-height: 26px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.inputStyle {
|
||||
width: 50px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
</style>
|
||||
@@ -6,31 +6,20 @@
|
||||
</el-button>
|
||||
<addGroup ref="addGroupRef" @success="resetHandle" />
|
||||
</div>
|
||||
<div class="head-container" id="table_drag">
|
||||
<el-table :data="tableData.list" v-loading="tableData.loading" row-key="id">
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.list" v-loading="tableData.loading">
|
||||
<el-table-column label="排序" sortable prop="sort"></el-table-column>
|
||||
<el-table-column label="分组名称" prop="name"></el-table-column>
|
||||
<el-table-column label="售卖时间管控" prop="useTime">
|
||||
<template v-slot="scope">
|
||||
<template v-if="scope.row.useTime == 1">
|
||||
|
||||
<!-- {{ scope.row.saleStartTime + '-' + (scope.row.saleEndTime) }} -->
|
||||
{{ saleEndTimeFilter(scope.row.saleStartTime, scope.row.saleEndTime) }}
|
||||
<!-- {{ new Date(scope.row.saleEndTime+'').getTime() }} -->
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态">
|
||||
<template v-slot="scope">
|
||||
<el-switch v-model="scope.row.isShow" :active-value="1" :inactive-value="0"
|
||||
@change="showChange($event, scope.row)"></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="240">
|
||||
<el-table-column label="操作" width="200">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" icon="el-icon-rank" v-if="isPcBowser">排序</el-button>
|
||||
<el-button type="text" size="mini" round icon="el-icon-edit" @click="$refs.addGroupRef.show(scope.row)"
|
||||
style="margin-left: 20px !important;">编辑</el-button>
|
||||
<el-button type="text" size="mini" round icon="el-icon-edit"
|
||||
@click="$refs.addGroupRef.show(scope.row)">编辑</el-button>
|
||||
<el-popconfirm title="确定删除吗?" @confirm="delHandle([scope.row.id])">
|
||||
<el-button type="text" size="mini" round icon="el-icon-delete" slot="reference">
|
||||
删除
|
||||
@@ -46,9 +35,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Sortable from 'sortablejs'
|
||||
import addGroup from '../components/addGroup'
|
||||
import { tbProductGroupGet, tbProductGroupDelete, tbProductGroupPut, upGroupSort } from '@/api/shop'
|
||||
import { tbProductGroupGet, tbProductGroupDelete, tbProductGroupPut } from '@/api/shop'
|
||||
export default {
|
||||
components: {
|
||||
addGroup
|
||||
@@ -57,7 +45,7 @@ export default {
|
||||
return {
|
||||
tableData: {
|
||||
page: 0,
|
||||
size: 30,
|
||||
size: 10,
|
||||
total: 0,
|
||||
loading: false,
|
||||
list: []
|
||||
@@ -66,51 +54,8 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.getTableData()
|
||||
if (this.isPcBowser) {
|
||||
this.$nextTick(() => {
|
||||
this.tableDrag()
|
||||
})
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
|
||||
},
|
||||
methods: {
|
||||
saleEndTimeFilter: (a, b) => {
|
||||
|
||||
var currentDate = new Date(); // 当前日期对象
|
||||
var dateString = currentDate.toDateString(); // 获取当前日期的字符串表示(不包含时分秒)
|
||||
var dateTimeString = dateString + ' ' + a; // 拼接日期和时分秒字符串
|
||||
var dateTimeStringb = dateString + ' ' + b; // 拼接日期和时分秒字符串
|
||||
var timestamp = Date.parse(dateTimeString); // 将日期时间字符串转换为时间戳
|
||||
var timestamp2 = Date.parse(dateTimeStringb); // 将日期时间字符串转换为时间戳
|
||||
let ciri = timestamp > timestamp2 ? '次日' : ''
|
||||
return a + ' - ' + ciri + b
|
||||
},
|
||||
//表格拖拽
|
||||
tableDrag() {
|
||||
const el = document.querySelector('#table_drag .el-table__body-wrapper tbody')
|
||||
new Sortable(el, {
|
||||
animation: 150,
|
||||
onEnd: async e => {
|
||||
// console.log('拖拽结束===', e);
|
||||
if (e.oldIndex == e.newIndex) return
|
||||
let oid = this.tableData.list[e.oldIndex].id
|
||||
let nid = this.tableData.list[e.newIndex].id
|
||||
let ids = this.tableData.list.map(item => item.id)
|
||||
try {
|
||||
await upGroupSort({
|
||||
strId: oid,
|
||||
endId: nid,
|
||||
ids: ids
|
||||
})
|
||||
await this.getTableData()
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 状态切换
|
||||
async showChange(e, row) {
|
||||
try {
|
||||
@@ -146,8 +91,8 @@ export default {
|
||||
},
|
||||
// 获取商品列表
|
||||
async getTableData() {
|
||||
try {
|
||||
this.tableData.loading = true
|
||||
try {
|
||||
const res = await tbProductGroupGet({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-button type="primary" @click="queryHandle">查询</el-button>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -31,9 +31,8 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="head-container" id="table_drag">
|
||||
<el-table ref="table" :data="tableData.data" v-loading="tableData.loading" row-key="id">
|
||||
<el-table-column prop="id" label="ID" width="50px"></el-table-column>
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.data" v-loading="tableData.loading">
|
||||
<el-table-column label="商品信息">
|
||||
<template v-slot="scope">
|
||||
<div class="shop_info">
|
||||
@@ -53,9 +52,6 @@
|
||||
<template v-slot="scope">
|
||||
<span>¥{{ scope.row.lowPrice }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品规格" prop="typeEnum">
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column label="销量/库存">
|
||||
<template v-slot="scope">
|
||||
@@ -83,9 +79,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="200">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" icon="el-icon-rank" v-if="isPcBowser">排序</el-button>
|
||||
<router-link :to="{ path: '/product/add_shop', query: { goods_id: scope.row.id } }"
|
||||
style="margin-left: 20px !important;">
|
||||
<router-link :to="{ path: '/product/add_shop', query: { goods_id: scope.row.id } }">
|
||||
<el-button type="text" icon="el-icon-edit">编辑</el-button>
|
||||
</router-link>
|
||||
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
|
||||
@@ -104,16 +98,14 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Sortable from 'sortablejs'
|
||||
import dayjs from 'dayjs'
|
||||
import settings from '@/settings'
|
||||
import { tbProduct, tbShopCategoryGet, tbProductDelete, tbProductIsHot, upProSort } from '@/api/shop'
|
||||
import { tbProduct, tbShopCategoryGet, tbProductDelete, tbProductIsHot } from '@/api/shop'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dayjs,
|
||||
query: {
|
||||
productId: '',
|
||||
name: '',
|
||||
categoryId: '',
|
||||
typeEnum: ''
|
||||
@@ -123,63 +115,24 @@ export default {
|
||||
tableData: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 30,
|
||||
size: 10,
|
||||
loading: false,
|
||||
total: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
console.log(this.$route.query.productId,'tiaoshi1')
|
||||
if (this.$route.query.productId) {
|
||||
this.query.productId = this.$route.query.productId
|
||||
}
|
||||
console.log(this.query)
|
||||
|
||||
await this.tbShopCategoryGet()
|
||||
await this.getTableData()
|
||||
if (this.isPcBowser) {
|
||||
this.$nextTick(() => {
|
||||
this.tableDrag()
|
||||
})
|
||||
}
|
||||
mounted() {
|
||||
this.getTableData()
|
||||
this.tbShopCategoryGet()
|
||||
},
|
||||
methods: {
|
||||
// 选择分类
|
||||
queryHandle() {
|
||||
localStorage.setItem('shopIndexQuery', JSON.stringify(this.query))
|
||||
this.getTableData()
|
||||
},
|
||||
//表格拖拽
|
||||
tableDrag() {
|
||||
const el = document.querySelector('#table_drag .el-table__body-wrapper tbody')
|
||||
new Sortable(el, {
|
||||
animation: 150,
|
||||
onEnd: async e => {
|
||||
// console.log('拖拽结束===', e);
|
||||
if (e.oldIndex == e.newIndex) return
|
||||
let oid = this.tableData.data[e.oldIndex].id
|
||||
let nid = this.tableData.data[e.newIndex].id
|
||||
let ids = this.tableData.data.map(item => item.id)
|
||||
try {
|
||||
await upProSort({
|
||||
strId: oid,
|
||||
endId: nid,
|
||||
ids: ids
|
||||
})
|
||||
await this.getTableData()
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 设置热门
|
||||
async changeHot(e, row) {
|
||||
console.log(row)
|
||||
try {
|
||||
this.tableData.loading = true
|
||||
await tbProductIsHot({
|
||||
isHot: e,
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
id: row.id
|
||||
})
|
||||
this.getTableData()
|
||||
@@ -192,9 +145,6 @@ export default {
|
||||
this.query.name = ''
|
||||
this.query.categoryId = ''
|
||||
this.query.typeEnum = ''
|
||||
this.query.productId = ''
|
||||
this.tableData.page = 0
|
||||
localStorage.setItem('shopIndexQuery', JSON.stringify(this.query))
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页回调
|
||||
@@ -204,20 +154,13 @@ export default {
|
||||
},
|
||||
// 获取商品列表
|
||||
async getTableData() {
|
||||
try {
|
||||
let localQuery = JSON.parse(localStorage.getItem('shopIndexQuery'))
|
||||
if (localQuery != null && localQuery.hasOwnProperty('productId')) {
|
||||
// this.query = localQuery
|
||||
}
|
||||
|
||||
this.tableData.loading = true
|
||||
console.log(this.query,'调试2')
|
||||
try {
|
||||
const res = await tbProduct({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
name: this.query.name,
|
||||
categoryId: this.query.categoryId,
|
||||
id: this.query.productId,
|
||||
typeEnum: this.query.typeEnum,
|
||||
shopId: localStorage.getItem('shopId')
|
||||
})
|
||||
@@ -256,15 +199,6 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.handle {
|
||||
font-size: 18px;
|
||||
color: #999;
|
||||
|
||||
&:hover {
|
||||
cursor: grab;
|
||||
}
|
||||
}
|
||||
|
||||
.shop_info {
|
||||
display: flex;
|
||||
|
||||
|
||||
@@ -106,8 +106,7 @@ export default {
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
sort: 'id',
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
name: this.query.blurry
|
||||
shopId: localStorage.getItem('shopId')
|
||||
})
|
||||
this.tableData.loading = false
|
||||
this.tableData.list = res.content
|
||||
|
||||
@@ -5,9 +5,6 @@
|
||||
<el-form-item label="店铺名称" prop="shopName">
|
||||
<el-input v-model="form.shopName" placeholder="请输入门店名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="连锁店扩展店名">
|
||||
<el-input v-model="form.chainName" placeholder="请输入连锁店扩展店名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="门店logo" prop="logo">
|
||||
<el-image :src="form.logo || require('@/assets/images/upload.png')" fit="contain"
|
||||
style="width: 80px;height: 80px;" @click="showUpload = true; uploadIndex = 1"></el-image>
|
||||
@@ -50,19 +47,16 @@
|
||||
<el-input-number v-model="form.takeaway_money" placeholder="0.00" controls-position="right"
|
||||
:min="0"></el-input-number>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="店铺经度" prop="provinces">
|
||||
<el-form-item label="店铺经度">
|
||||
<el-row>
|
||||
<el-col :span="9" v-if="form.provinces">
|
||||
<el-input :value="`${form.provinces}-${form.cities}-${form.districts}`" disabled />
|
||||
</el-col>
|
||||
<el-col :span="4" v-if="form.lng">
|
||||
<el-input v-model="form.lng" placeholder="经度" disabled></el-input>
|
||||
</el-col>
|
||||
<el-col :span="4" v-if="form.lng">
|
||||
<el-input v-model="form.lat" placeholder="纬度" disabled></el-input>
|
||||
<el-col :span="4">
|
||||
<el-input v-model="form.lng" placeholder="经度"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-button type="primary" plain icon="el-icon-place"
|
||||
<el-input v-model="form.lat" placeholder="纬度" style="margin-left: 10px;"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-button type="primary" plain icon="el-icon-place" style="margin-left: 20px;"
|
||||
@click="showLocation = true">选择坐标</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -84,7 +78,7 @@
|
||||
<el-dialog title="选择地址" :visible.sync="showLocation" :modal="false" :modal-append-to-body="false">
|
||||
<div class="map_box">
|
||||
<div class="map">
|
||||
<el-amap ref="map" :center="amapOptions.center">
|
||||
<el-amap :center="amapOptions.center">
|
||||
<el-amap-marker :position="amapOptions.center"></el-amap-marker>
|
||||
</el-amap>
|
||||
</div>
|
||||
@@ -92,6 +86,7 @@
|
||||
<el-amap-search-box :search-option="searchOption"
|
||||
:on-search-result="onSearchResult"></el-amap-search-box>
|
||||
</div>
|
||||
|
||||
<div class="search_wrap">
|
||||
<div class="item" v-for="item in locationSearchList" :key="item.id">
|
||||
<div class="left">
|
||||
@@ -135,7 +130,7 @@
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { mapGetters } from 'vuex'
|
||||
import crudQiNiu from '@/api/tools/qiniu'
|
||||
import { tbShopInfoPost, geocode } from '@/api/shop'
|
||||
import { tbShopInfoPost } from '@/api/shop'
|
||||
export default {
|
||||
computed: {
|
||||
...mapGetters([
|
||||
@@ -174,11 +169,7 @@ export default {
|
||||
detail: '',
|
||||
status: 1,
|
||||
logo: '',
|
||||
coverImg: '',
|
||||
provinces: '',
|
||||
cities: '',
|
||||
districts: '',
|
||||
chainName: ''
|
||||
coverImg: ''
|
||||
},
|
||||
resetForm: '',
|
||||
rules: {
|
||||
@@ -189,13 +180,6 @@ export default {
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
provinces: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择坐标',
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
logo: [
|
||||
{
|
||||
required: true,
|
||||
@@ -243,20 +227,10 @@ export default {
|
||||
this.amapOptions.center = [res[0].lng, res[0].lat]
|
||||
},
|
||||
// 确认地址选择
|
||||
async selectLocationHandle(item) {
|
||||
console.log(item);
|
||||
selectLocationHandle(item) {
|
||||
this.form.lng = item.lng
|
||||
this.form.lat = item.lat
|
||||
this.form.address = item.address
|
||||
this.showLocation = false
|
||||
|
||||
const position = `${item.lng},${item.lat}`;
|
||||
const res = JSON.parse(await geocode({ location: position }))
|
||||
console.log(res);
|
||||
|
||||
this.form.provinces = res.addressComponent.province
|
||||
this.form.cities = res.addressComponent.city
|
||||
this.form.districts = res.addressComponent.district
|
||||
},
|
||||
// 保存
|
||||
submitHandle() {
|
||||
|
||||
@@ -1,180 +0,0 @@
|
||||
<template>
|
||||
<el-dialog :title="title" :visible.sync="dialogVisible" @open="reset">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="140px" label-position="left">
|
||||
<el-form-item label="员工姓名" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入员工姓名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="员工编号" prop="code">
|
||||
<el-input v-model="form.code" placeholder="请输入员工编号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="phone">
|
||||
<el-input v-model="form.phone" placeholder="请输入手机号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="员工账号" prop="account">
|
||||
<el-input v-model="form.account" placeholder="请输入员工账号,建议使用手机号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="登录密码">
|
||||
<el-input type="password" v-model="form.password" placeholder="请输入登录密码,不填默认123456" />
|
||||
</el-form-item>
|
||||
<el-form-item label="最大优惠金额">
|
||||
<el-input-number v-model="form.maxDiscountAmount" controls-position="right" :min="0"
|
||||
:max="100000"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="角色" prop="roleId">
|
||||
<el-select v-model="form.roleId" placeholder="请选择角色">
|
||||
<el-option :label="item.name" :value="item.id" v-for="item in roles" :key="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="允许登录PC桌面端">
|
||||
<el-switch v-model="form.isPc" :active-value="1" :inactive-value="0"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="允许登录管理端">
|
||||
<el-switch v-model="form.isManage" :active-value="1" :inactive-value="0"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否启用">
|
||||
<el-switch v-model="form.status" :active-value="1" :inactive-value="0"></el-switch>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="onSubmitHandle">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { tbPlussShopStaff, rolesGet, tbPlussShopStaffDetail } from '@/api/shop.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
loading: false,
|
||||
form: {
|
||||
id: '',
|
||||
name: '',
|
||||
code: '',
|
||||
account: '',
|
||||
maxDiscountAmount: '',
|
||||
status: 1,
|
||||
isPc: 1,
|
||||
isManage: 1,
|
||||
roleId: '',
|
||||
phone: '',
|
||||
password: ''
|
||||
},
|
||||
resetForm: '',
|
||||
rules: {
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
message: ' ',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
code: [
|
||||
{
|
||||
required: true,
|
||||
message: ' ',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
account: [
|
||||
{
|
||||
required: true,
|
||||
message: ' ',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
maxDiscountAmount: [
|
||||
{
|
||||
required: true,
|
||||
message: ' ',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
roleId: [
|
||||
{
|
||||
required: true,
|
||||
message: ' ',
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
phone: [
|
||||
{
|
||||
required: true,
|
||||
message: ' ',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
},
|
||||
roles: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
title() {
|
||||
return this.form.id ? '编辑员工' : '添加员工'
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.resetForm = { ...this.form }
|
||||
this.rolesGet()
|
||||
},
|
||||
methods: {
|
||||
// 添加或编辑员工
|
||||
onSubmitHandle() {
|
||||
this.$refs.form.validate(async valid => {
|
||||
if (valid) {
|
||||
try {
|
||||
this.loading = true
|
||||
await tbPlussShopStaff(this.form)
|
||||
this.loading = false
|
||||
this.$emit('success')
|
||||
this.close()
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: `${this.title}成功`,
|
||||
type: 'success'
|
||||
});
|
||||
} catch (error) {
|
||||
this.loading = false
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取角色列表
|
||||
async rolesGet() {
|
||||
try {
|
||||
const { content } = await rolesGet()
|
||||
this.roles = content
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
reset() {
|
||||
this.form = { ...this.resetForm }
|
||||
},
|
||||
close() {
|
||||
this.dialogVisible = false
|
||||
},
|
||||
show(row) {
|
||||
this.dialogVisible = true
|
||||
if (row && row.id) {
|
||||
// this.form = { ...row }
|
||||
this.tbPlussShopStaffDetail(row.id)
|
||||
} else {
|
||||
this.reset()
|
||||
}
|
||||
},
|
||||
// 通过id获取员工信息
|
||||
async tbPlussShopStaffDetail(id) {
|
||||
try {
|
||||
const res = await tbPlussShopStaffDetail(id)
|
||||
this.form = res
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -12,12 +12,6 @@
|
||||
<el-form-item label="支付密码">
|
||||
<el-input v-model="form.payPassword" placeholder="请输入支付密码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="小程序appid">
|
||||
<el-input v-model="form.smallAppid" placeholder="请输入小程序appid"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="店铺id">
|
||||
<el-input v-model="form.storeId" placeholder="请输入店铺id"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio :label="1">启用</el-radio>
|
||||
@@ -50,9 +44,7 @@ export default ({
|
||||
id: '',
|
||||
payPassword: '',
|
||||
status: 1,
|
||||
appId: '',
|
||||
smallAppid: '',
|
||||
storeId: ''
|
||||
appId: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -93,8 +85,6 @@ export default ({
|
||||
this.form.payPassword = res.payPassword
|
||||
this.form.status = res.status
|
||||
this.form.appId = res.appId
|
||||
this.form.smallAppid = res.smallAppid
|
||||
this.form.storeId = res.storeId
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
@@ -1,196 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-button type="primary" @click="resetting">添加</el-button>
|
||||
<el-table :data="tableData">
|
||||
<el-table-column label="类型" prop="type">
|
||||
<template v-slot="row">
|
||||
{{ row.row.type == 'text' ? '文本' : '图片' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="key" prop="autokey"> </el-table-column>
|
||||
<el-table-column label="value" prop="value">
|
||||
<template v-slot="row">
|
||||
<img v-if="row.row.type == 'img'" :src="row.row.value" style="width: 40px;height: 40px;">
|
||||
<span v-else>{{ row.row.value }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="更新时间" prop="updateTime"> </el-table-column>
|
||||
<el-table-column label="创建时间" prop="createTime"> </el-table-column>
|
||||
<el-table-column label="操作" width="250">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" size="mini" round icon="el-icon-edit"
|
||||
@click="edit(scope.row.id)">编辑</el-button>
|
||||
<el-popconfirm title="确定删除吗?" @confirm="delHandle([scope.row.id])">
|
||||
<el-button type="text" size="mini" round icon="el-icon-delete" slot="reference">
|
||||
删除
|
||||
</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-dialog :title="title" :visible.sync="showLocation">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px" label-position="left">
|
||||
<el-form-item label="类型" v-if="title == '新增'">
|
||||
<el-radio v-model="form.type" label="text">文本</el-radio>
|
||||
<el-radio v-model="form.type" label="img">图片</el-radio>
|
||||
</el-form-item>
|
||||
<el-form-item label="自定义key">
|
||||
<el-input v-model="form.autokey" placeholder="请输入内容"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="上传图片" v-if="form.type == 'img'">
|
||||
<el-upload :headers="headers" class="avatar-uploader" :action="qiNiuUploadApi"
|
||||
:show-file-list="false" :on-success="handleSuccess">
|
||||
<img v-if="imageUrl" :src="imageUrl" class="avatar">
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item label="文本" v-else>
|
||||
<el-input v-model="form.value" placeholder="请输入内容"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="showLocation = false">取消</el-button>
|
||||
<el-button type="primary" @click="doSubmit">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { tbShopExtend, addtbShopExtend, deletetbShopExtend, querytbShopExtend, edittbShopExtend } from '@/api/extend'
|
||||
import { getToken } from "@/utils/auth";
|
||||
import { mapGetters } from "vuex";
|
||||
export default {
|
||||
computed: {
|
||||
...mapGetters(["qiNiuUploadApi"])
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableData: [],
|
||||
showLocation: false,
|
||||
fileList: [],
|
||||
form: {
|
||||
type: 'text',
|
||||
},
|
||||
imageUrl: '',
|
||||
title: '新增',
|
||||
rules: {
|
||||
},
|
||||
headers: {
|
||||
Authorization: getToken()
|
||||
},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getList()
|
||||
},
|
||||
watch: {
|
||||
'form.type': (n, o) => {
|
||||
if (n == 'img') {
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleBeforeRemove(file, fileList) {
|
||||
|
||||
},
|
||||
async edit(id) {
|
||||
this.title = '编辑'
|
||||
let res = await querytbShopExtend(id)
|
||||
this.form.id = id
|
||||
this.showLocation = true
|
||||
this.form = res
|
||||
this.imageUrl = res.value
|
||||
},
|
||||
// 删除
|
||||
async delHandle(proId) {
|
||||
let res = await deletetbShopExtend({ idList: proId[0] })
|
||||
this.$message({
|
||||
message: '删除成功',
|
||||
type: 'success'
|
||||
})
|
||||
this.getList()
|
||||
|
||||
},
|
||||
// 刷新列表数据
|
||||
async doSubmit() {
|
||||
if (this.title == '新增') {
|
||||
let res = await addtbShopExtend({
|
||||
...this.form,
|
||||
shopId: localStorage.getItem('shopId')
|
||||
})
|
||||
this.$message({
|
||||
message: '添加成功',
|
||||
type: 'success'
|
||||
})
|
||||
|
||||
} else {
|
||||
let res = await edittbShopExtend({
|
||||
...this.form,
|
||||
})
|
||||
this.$message({
|
||||
message: '编辑成功',
|
||||
type: 'success'
|
||||
})
|
||||
}
|
||||
this.form = null
|
||||
this.form = {
|
||||
type: 'text',
|
||||
}
|
||||
this.imageUrl = ''
|
||||
this.showLocation = false
|
||||
this.getList()
|
||||
},
|
||||
handleSuccess(response, file, fileList) {
|
||||
this.imageUrl = response.data[0];
|
||||
this.form.value = response.data[0]
|
||||
console.log("上传成功", this.form);
|
||||
},
|
||||
|
||||
async getList() {
|
||||
let res = await tbShopExtend({
|
||||
shopId: localStorage.getItem('shopId')
|
||||
})
|
||||
this.tableData = res.content
|
||||
},
|
||||
resetting() {
|
||||
this.title = '新增'
|
||||
this.form = null
|
||||
this.form = {
|
||||
type: 'text',
|
||||
}
|
||||
this.imageUrl = ''
|
||||
this.showLocation = true
|
||||
},
|
||||
addtbShopExtend() { }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.avatar-uploader .el-upload {
|
||||
border: 1px dashed #d9d9d9;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.avatar-uploader .el-upload:hover {
|
||||
border-color: #409EFF;
|
||||
}
|
||||
|
||||
.avatar-uploader-icon {
|
||||
font-size: 28px;
|
||||
color: #8c939d;
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
line-height: 178px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
@@ -1,86 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form ref="form" :model="form" label-width="120px" label-position="left">
|
||||
<el-form-item label="操作密码">
|
||||
<el-input v-model="form.password" type="number" @input="jiantingshuru" :disabled="disabled"
|
||||
:placeholder="disabled ? '******' : '请输入操作密码'" style="width: 200px;"></el-input>
|
||||
<el-button type="primary" @click="resetting">重置</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="安全手机号">
|
||||
{{ form.phone | phoneFilter }}
|
||||
</el-form-item>
|
||||
<el-form-item label="验证码">
|
||||
<el-input v-model="form.prepareAmount" placeholder="点击发送" style="width: 200px;"></el-input>
|
||||
<el-button type="primary" @click="onSubmit">发送</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submitHandle">保存 </el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import md5 from 'js-md5';
|
||||
import { tbShopInfo } from "@/api/user";
|
||||
import { sendMsg, modfiyUserInfo } from "@/api/securitySetting"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
disabled: true,
|
||||
form: {}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getinfo()
|
||||
},
|
||||
methods: {
|
||||
jiantingshuru(e) {
|
||||
this.form.password = e.substr(0, 6)
|
||||
},
|
||||
// 获取用户信息
|
||||
async getinfo() {
|
||||
const shopId = localStorage.getItem("shopId");
|
||||
const res = await tbShopInfo(shopId);
|
||||
this.form = res
|
||||
// this.form.password = '******'
|
||||
},
|
||||
async submitHandle() {
|
||||
let data = {
|
||||
code: this.form.prepareAmount,
|
||||
pwd: md5(this.form.password),
|
||||
}
|
||||
if (!this.form.prepareAmount) {
|
||||
this.$message({
|
||||
message: "请输入验证码或密码"
|
||||
})
|
||||
return
|
||||
}
|
||||
const res = await modfiyUserInfo(data);
|
||||
this.form.prepareAmount = ''
|
||||
this.form.password = "******"
|
||||
this.disabled = true
|
||||
this.$message({
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
})
|
||||
},
|
||||
resetting() {
|
||||
this.form.password = ''
|
||||
this.disabled = false
|
||||
},
|
||||
async onSubmit() {
|
||||
const res = await sendMsg();
|
||||
this.$message({
|
||||
message: '发送成功',
|
||||
type: 'success'
|
||||
})
|
||||
},
|
||||
},
|
||||
filters: {
|
||||
phoneFilter(d) {
|
||||
let str = d + ''
|
||||
return str.substr(0, 3) + '***' + str.substr(-4)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,86 +1,120 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="140px" label-position="left">
|
||||
<el-form
|
||||
ref="form"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="120px"
|
||||
label-position="left"
|
||||
>
|
||||
<el-form-item label="门店名称" prop="shopName">
|
||||
<el-input v-model="form.shopName" placeholder="请输入门店名称" style="width: 500px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="连锁店扩展店名">
|
||||
<el-input v-model="form.chainName" placeholder="请输入连锁店扩展店名" style="width: 500px;"></el-input>
|
||||
<el-input
|
||||
v-model="form.shopName"
|
||||
placeholder="请输入门店名称"
|
||||
style="width: 500px;"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="门店logo">
|
||||
<el-image :src="form.logo || require('@/assets/images/upload.png')" fit="contain"
|
||||
style="width: 80px;height: 80px;" @click="
|
||||
<el-image
|
||||
:src="form.logo || require('@/assets/images/upload.png')"
|
||||
fit="contain"
|
||||
style="width: 80px;height: 80px;"
|
||||
@click="
|
||||
showUpload = true;
|
||||
uploadIndex = 1;
|
||||
"></el-image>
|
||||
"
|
||||
></el-image>
|
||||
</el-form-item>
|
||||
<el-form-item label="门店照片">
|
||||
<el-image :src="form.coverImg || require('@/assets/images/upload.png')" fit="contain"
|
||||
style="width: 80px;height: 80px;" @click="
|
||||
<el-image
|
||||
:src="form.coverImg || require('@/assets/images/upload.png')"
|
||||
fit="contain"
|
||||
style="width: 80px;height: 80px;"
|
||||
@click="
|
||||
showUpload = true;
|
||||
uploadIndex = 2;
|
||||
"></el-image>
|
||||
"
|
||||
></el-image>
|
||||
</el-form-item>
|
||||
<el-form-item label="微信二维码">
|
||||
<el-image :src="form.shopQrcode || require('@/assets/images/upload.png')" fit="contain"
|
||||
style="width: 80px;height: 80px;" @click="
|
||||
<el-image
|
||||
:src="form.shopQrcode || require('@/assets/images/upload.png')"
|
||||
fit="contain"
|
||||
style="width: 80px;height: 80px;"
|
||||
@click="
|
||||
showUpload = true;
|
||||
uploadIndex = 3;
|
||||
"></el-image>
|
||||
"
|
||||
></el-image>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系电话" prop="phone">
|
||||
<el-input v-model="form.phone" placeholder="请输入联系电话" style="width: 500px;"></el-input>
|
||||
<el-input
|
||||
v-model="form.phone"
|
||||
placeholder="请输入联系电话"
|
||||
style="width: 500px;"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="外卖起送金额">
|
||||
<el-input-number v-model="form.takeaway_money" placeholder="0.00" controls-position="right"
|
||||
:min="0"></el-input-number>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="店铺经度" prop="provinces">
|
||||
<el-form-item label="店铺经度">
|
||||
<el-row>
|
||||
<el-col :span="9" v-if="form.provinces">
|
||||
<el-input :value="`${form.provinces}-${form.cities}-${form.districts}`" disabled />
|
||||
</el-col>
|
||||
<el-col :span="4" v-if="form.lng">
|
||||
<el-input v-model="form.lng" placeholder="经度" disabled></el-input>
|
||||
</el-col>
|
||||
<el-col :span="4" v-if="form.lng">
|
||||
<el-input v-model="form.lat" placeholder="纬度" disabled></el-input>
|
||||
<el-col :span="4">
|
||||
<el-input v-model="form.lng" placeholder="经度"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-button type="primary" plain icon="el-icon-place" @click="showLocation = true">选择坐标</el-button>
|
||||
<el-input
|
||||
v-model="form.lat"
|
||||
placeholder="纬度"
|
||||
style="margin-left: 10px;"
|
||||
></el-input>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-place"
|
||||
style="margin-left: 20px;"
|
||||
@click="showLocation = true"
|
||||
>选择坐标</el-button
|
||||
>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div style="color: #999;">注:准确的定位便于用户导航到店铺</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="门店详细地址">
|
||||
<el-input type="textarea" v-model="form.address" placeholder="请输入门店详细地址" style="width: 500px;"></el-input>
|
||||
<el-input
|
||||
type="textarea"
|
||||
v-model="form.address"
|
||||
placeholder="请输入门店详细地址"
|
||||
style="width: 500px;"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="营业时间">
|
||||
<el-select v-model="form.businessStartDay" placeholder="周几开始">
|
||||
<el-option :value="item.label" :label="item.label" v-for="item in weeks" :key="item.value"></el-option>
|
||||
</el-select>
|
||||
<el-select v-model="form.businessEndDay" placeholder="周几结束">
|
||||
<el-option :value="item.label" :label="item.label" v-for="item in weeks" :key="item.value"></el-option>
|
||||
</el-select>
|
||||
<el-time-picker placeholder="起始时间" v-model="startTime" :picker-options="{
|
||||
<el-time-picker
|
||||
placeholder="起始时间"
|
||||
v-model="startTime"
|
||||
:picker-options="{
|
||||
selectableRange: '00:00:00 - 23:59:59',
|
||||
format: 'HH:mm'
|
||||
}" format="HH:mm" value-format="HH:mm">
|
||||
}"
|
||||
format="HH:mm"
|
||||
value-format="HH:mm"
|
||||
>
|
||||
</el-time-picker>
|
||||
<el-time-picker placeholder="结束时间" v-model="endTime" :picker-options="{
|
||||
selectableRange:'00:00:00 - 23:59:59',
|
||||
}" format="HH:mm" value-format="HH:mm">
|
||||
<el-time-picker
|
||||
placeholder="结束时间"
|
||||
v-model="endTime"
|
||||
:picker-options="{
|
||||
selectableRange: `${startTime}:00 - 23:59:59`
|
||||
}"
|
||||
format="HH:mm"
|
||||
value-format="HH:mm"
|
||||
>
|
||||
</el-time-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否开启8折活动">
|
||||
<el-switch v-model="form.isOpenYhq" active-value="true" inactive-value="false"></el-switch>
|
||||
<!-- <div style="color: #999;">是否允许用户在小程序端支付订单</div> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="是否开启会员支付">
|
||||
<el-switch v-model="form.isUseVip" :active-value="1" :inactive-value="0"></el-switch>
|
||||
<!-- <div style="color: #999;">是否允许用户在小程序端支付订单</div> -->
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="结算类型">
|
||||
<el-radio-group v-model="form.settleType">
|
||||
<el-radio :label="0">今日</el-radio>
|
||||
@@ -101,7 +135,12 @@
|
||||
</el-time-picker>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="店铺简介">
|
||||
<el-input type="textarea" v-model="form.detail" placeholder="请输入店铺简介" style="width: 500px;"></el-input>
|
||||
<el-input
|
||||
type="textarea"
|
||||
v-model="form.detail"
|
||||
placeholder="请输入店铺简介"
|
||||
style="width: 500px;"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-radio-group v-model="form.status">
|
||||
@@ -110,7 +149,11 @@
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submitHandle" :loading="formLoading">
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="submitHandle"
|
||||
:loading="formLoading"
|
||||
>
|
||||
<span v-if="!formLoading">保存</span>
|
||||
<span v-else>保存中...</span>
|
||||
</el-button>
|
||||
@@ -125,7 +168,10 @@
|
||||
</el-amap>
|
||||
</div>
|
||||
<div class="search_box">
|
||||
<el-amap-search-box :search-option="searchOption" :on-search-result="onSearchResult"></el-amap-search-box>
|
||||
<el-amap-search-box
|
||||
:search-option="searchOption"
|
||||
:on-search-result="onSearchResult"
|
||||
></el-amap-search-box>
|
||||
</div>
|
||||
|
||||
<div class="search_wrap">
|
||||
@@ -143,10 +189,23 @@
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-dialog :visible.sync="showUpload" :close-on-click-modal="false" append-to-body width="500px"
|
||||
@close="showUpload = false">
|
||||
<el-upload :before-remove="handleBeforeRemove" :on-success="handleSuccess" :on-error="handleError"
|
||||
:file-list="fileList" :headers="headers" :action="qiNiuUploadApi" class="upload-demo" multiple>
|
||||
<el-dialog
|
||||
:visible.sync="showUpload"
|
||||
:close-on-click-modal="false"
|
||||
append-to-body
|
||||
width="500px"
|
||||
@close="showUpload = false"
|
||||
>
|
||||
<el-upload
|
||||
:before-remove="handleBeforeRemove"
|
||||
:on-success="handleSuccess"
|
||||
:on-error="handleError"
|
||||
:file-list="fileList"
|
||||
:headers="headers"
|
||||
:action="qiNiuUploadApi"
|
||||
class="upload-demo"
|
||||
multiple
|
||||
>
|
||||
<el-button size="small" type="primary">点击上传</el-button>
|
||||
<div slot="tip" style="display: block;" class="el-upload__tip">
|
||||
请勿上传违法文件,且文件不超过15M
|
||||
@@ -164,7 +223,6 @@ import { getToken } from "@/utils/auth";
|
||||
import { mapGetters } from "vuex";
|
||||
import crudQiNiu from "@/api/tools/qiniu";
|
||||
import { tbShopInfo, tbShopInfoPut } from "@/api/user";
|
||||
import { geocode } from '@/api/shop'
|
||||
export default {
|
||||
computed: {
|
||||
...mapGetters(["qiNiuUploadApi"])
|
||||
@@ -214,37 +272,7 @@ export default {
|
||||
amapOptions: {
|
||||
center: [108.946465, 34.347984],
|
||||
position: []
|
||||
},
|
||||
weeks: [
|
||||
{
|
||||
value: '1',
|
||||
label: '周一'
|
||||
},
|
||||
{
|
||||
value: '2',
|
||||
label: '周二'
|
||||
},
|
||||
{
|
||||
value: '3',
|
||||
label: '周三'
|
||||
},
|
||||
{
|
||||
value: '4',
|
||||
label: '周四'
|
||||
},
|
||||
{
|
||||
value: '5',
|
||||
label: '周五'
|
||||
},
|
||||
{
|
||||
value: '6',
|
||||
label: '周六'
|
||||
},
|
||||
{
|
||||
value: '7',
|
||||
label: '周天'
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
@@ -256,19 +284,10 @@ export default {
|
||||
this.amapOptions.center = [res[0].lng, res[0].lat];
|
||||
},
|
||||
// 确认地址选择
|
||||
async selectLocationHandle(item) {
|
||||
selectLocationHandle(item) {
|
||||
this.form.lng = item.lng;
|
||||
this.form.lat = item.lat;
|
||||
this.form.address = item.address
|
||||
this.showLocation = false;
|
||||
|
||||
const position = `${item.lng},${item.lat}`;
|
||||
const res = JSON.parse(await geocode({ location: position }))
|
||||
console.log(res);
|
||||
|
||||
this.form.provinces = res.addressComponent.province
|
||||
this.form.cities = res.addressComponent.city
|
||||
this.form.districts = res.addressComponent.district
|
||||
},
|
||||
// 获取用户详情
|
||||
async tbShopInfo() {
|
||||
@@ -281,7 +300,7 @@ export default {
|
||||
this.startTime = businessTime[0];
|
||||
this.endTime = businessTime[1];
|
||||
}
|
||||
} catch (error) { }
|
||||
} catch (error) {}
|
||||
},
|
||||
// 保存
|
||||
submitHandle() {
|
||||
@@ -300,7 +319,7 @@ export default {
|
||||
message: "提交成功",
|
||||
type: "success"
|
||||
});
|
||||
} catch (error) { }
|
||||
} catch (error) {}
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -314,7 +333,7 @@ export default {
|
||||
handleBeforeRemove(file, fileList) {
|
||||
for (let i = 0; i < this.files.length; i++) {
|
||||
if (this.files[i].uid === file.uid) {
|
||||
crudQiNiu.del([this.files[i].id]).then(res => { });
|
||||
crudQiNiu.del([this.files[i].id]).then(res => {});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
<el-dropdown @command="dropdownClick">
|
||||
<el-button type="text">更多<i class="el-icon-arrow-down"></i></el-button>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item :command="{ row: scope.row, command: 1 }">三方配置</el-dropdown-item>
|
||||
<el-dropdown-item :command="{ row: scope.row, command: 1 }">详情</el-dropdown-item>
|
||||
<el-dropdown-item :command="2">续费记录</el-dropdown-item>
|
||||
<el-dropdown-item :command="3">前往店铺</el-dropdown-item>
|
||||
<el-dropdown-item :command="4">重置密码</el-dropdown-item>
|
||||
|
||||
@@ -1,177 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="head-container">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="3">
|
||||
店铺推送: <el-switch v-model="alldata.allState" :active-value="1" :inactive-value="0"
|
||||
@change="changeEvent(alldata.allState, '')"></el-switch>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
耗材: <el-switch v-model="alldata.conState" :active-value="1" :inactive-value="0"
|
||||
@change="changeEvent(alldata.conState, 1)"></el-switch>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
操作商品: <el-switch v-model="alldata.opeState" :active-value="1" :inactive-value="0"
|
||||
@change="changeEvent(alldata.opeState, 2)"></el-switch>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
商品库存: <el-switch v-model="alldata.stockState" :active-value="1" :inactive-value="0"
|
||||
@change="changeEvent(alldata.stockState, 0)"></el-switch>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="head-container" id="table_drag">
|
||||
<el-table ref="table" :data="tableData.data" v-loading="tableData.loading" row-key="id">
|
||||
<el-table-column label="头像">
|
||||
<template v-slot="scope">
|
||||
<div class="shop_info">
|
||||
<el-image :src="scope.row.avatar"
|
||||
style="width: 50px;height: 50px;border-radius: 4px;background-color: #efefef;">
|
||||
<div class="img_error" slot="error">
|
||||
<i class="icon el-icon-document-delete"></i>
|
||||
</div>
|
||||
</el-image>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="昵称" prop="nickname"> </el-table-column>
|
||||
<el-table-column label="商品库存" prop="createdAt">
|
||||
<template v-slot="scope">
|
||||
<el-switch v-model="scope.row.proState" :active-value="1" :inactive-value="0"
|
||||
@change="changeHot(scope.row.proState, 0, scope.row.openId)"></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="耗材" prop="createdAt">
|
||||
<template v-slot="scope">
|
||||
<el-switch v-model="scope.row.conState" :active-value="1" :inactive-value="0"
|
||||
@change="changeHot(scope.row.conState, 1, scope.row.openId)"></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作商品" prop="createdAt">
|
||||
<template v-slot="scope">
|
||||
<el-switch v-model="scope.row.opeState" :active-value="1" :inactive-value="0"
|
||||
@change="changeHot(scope.row.opeState, 2, scope.row.openId)"></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="200">
|
||||
<template v-slot="scope">
|
||||
<el-popconfirm title="确定解绑吗?" @confirm="delTableHandle(scope.row.openId)">
|
||||
<el-button type="text" slot="reference">解绑</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
||||
@current-change="paginationChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { msgall, msginfo, shopState, state, delmsg } from '@/api/notifications'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
test: "1",
|
||||
tableData: {
|
||||
data: [],
|
||||
page: 1,
|
||||
size: 30,
|
||||
loading: false,
|
||||
total: 0
|
||||
},
|
||||
alldata: {
|
||||
allState: 0,
|
||||
conState: 0,
|
||||
opeState: 0,
|
||||
stockState: 0,
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getTableData()
|
||||
this.getlist()
|
||||
},
|
||||
methods: {
|
||||
async getlist() {
|
||||
let res = await state({
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
})
|
||||
this.alldata = res
|
||||
},
|
||||
async changeEvent(state, type) {
|
||||
let res = await shopState({
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
type,
|
||||
state
|
||||
})
|
||||
|
||||
},
|
||||
// 设置消息推送
|
||||
async changeHot(row, index, openId) {
|
||||
// index 0商品库存 1耗材 2操作商品
|
||||
let obj = {
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
type: index,
|
||||
state: row, openId
|
||||
}
|
||||
let res = await msginfo(obj)
|
||||
this.$message.success('修改成功!')
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1
|
||||
this.getTableData()
|
||||
},
|
||||
// 获取商品列表
|
||||
async getTableData() {
|
||||
try {
|
||||
this.tableData.loading = true
|
||||
const res = await msgall({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
shopId: localStorage.getItem('shopId')
|
||||
})
|
||||
this.tableData.loading = false
|
||||
this.tableData.data = res.records
|
||||
this.tableData.total = res.total
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
|
||||
// 删除商品
|
||||
async delTableHandle(ids) {
|
||||
try {
|
||||
await delmsg({
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
openId: ids
|
||||
})
|
||||
this.getTableData()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.shop_info {
|
||||
display: flex;
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
padding-left: 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.tag_wrap {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -3,31 +3,19 @@
|
||||
<el-tabs v-model="activeName" type="card">
|
||||
<el-tab-pane label="店铺信息" name="1"></el-tab-pane>
|
||||
<el-tab-pane label="基础配置" name="2"></el-tab-pane>
|
||||
<!-- <el-tab-pane label="通知配置" name="3"></el-tab-pane> -->
|
||||
<el-tab-pane label="安全设置" name="4"></el-tab-pane>
|
||||
<el-tab-pane label="扩展参数" name="5"></el-tab-pane>
|
||||
|
||||
</el-tabs>
|
||||
<shopInfo v-if="activeName == 1" />
|
||||
<shopSetting v-if="activeName == 2" />
|
||||
<notice v-if="activeName == 3" />
|
||||
<securitySetting v-if="activeName == 4" />
|
||||
<extend v-if="activeName == 5" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import shopInfo from './components/shopInfo'
|
||||
import shopSetting from './components/shopSetting'
|
||||
import notice from './components/notice'
|
||||
import securitySetting from './components/securitySetting'
|
||||
import extend from './components/extend'
|
||||
export default {
|
||||
components: {
|
||||
shopInfo,
|
||||
shopSetting,
|
||||
notice,securitySetting,extend
|
||||
shopSetting
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="head-container">
|
||||
<el-button type="primary" icon="el-icon-plus" @click="$refs.addStaff.show()">
|
||||
添加员工
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.list" v-loading="tableData.loading">
|
||||
<el-table-column label="员工名称" prop="name"></el-table-column>
|
||||
<el-table-column label="员工编号" prop="code"></el-table-column>
|
||||
<el-table-column label="员工账号" prop="account"></el-table-column>
|
||||
<el-table-column label="是否启用" prop="status">
|
||||
<template v-slot="scope">
|
||||
<el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0"
|
||||
@change="statusChange($event, scope.row)"></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" width="120">
|
||||
<template v-slot="scope">
|
||||
<div class="btn_rows" style="display: flex;gap: 10px;">
|
||||
<el-button type="text" icon="el-icon-edit"
|
||||
@click="$refs.addStaff.show(scope.row)">编辑</el-button>
|
||||
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
|
||||
<el-button type="text" icon="el-icon-delete" slot="reference">删除</el-button>
|
||||
</el-popconfirm>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-pagination @size-change="paginationSizeChange" :total="tableData.total"
|
||||
:current-page="tableData.page + 1" :page-size="tableData.size" @current-change="paginationChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
</div>
|
||||
<addStaff ref="addStaff" @success="resetHandle" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import addStaff from './components/addStaff.vue'
|
||||
import { tbPlussShopStaffGet, updateStatus, shopStaffDelete } from '@/api/shop.js'
|
||||
export default {
|
||||
components: {
|
||||
addStaff
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
query: {},
|
||||
tableData: {
|
||||
page: 0,
|
||||
size: 30,
|
||||
total: 0,
|
||||
loading: false,
|
||||
list: []
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getTableData()
|
||||
},
|
||||
methods: {
|
||||
// 删除
|
||||
async delTableHandle(ids) {
|
||||
try {
|
||||
const res = await shopStaffDelete(ids)
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: `已删除`,
|
||||
type: 'success'
|
||||
});
|
||||
this.getTableData()
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 修改员工状态
|
||||
async statusChange(e, row) {
|
||||
try {
|
||||
const res = await updateStatus({
|
||||
id: row.id,
|
||||
status: e
|
||||
})
|
||||
this.getTableData()
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.tableData.page = 0
|
||||
this.getTableData()
|
||||
},
|
||||
// 每页条数改变是回调
|
||||
paginationSizeChange(e) {
|
||||
this.tableData.size = e
|
||||
this.tableData.page = 0
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1
|
||||
this.getTableData()
|
||||
},
|
||||
// 获取员工列表
|
||||
async getTableData() {
|
||||
try {
|
||||
this.tableData.loading = true
|
||||
const res = await tbPlussShopStaffGet({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size
|
||||
})
|
||||
this.tableData.loading = false
|
||||
this.tableData.list = res.content
|
||||
this.tableData.total = res.totalElements
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,30 +1,33 @@
|
||||
<template>
|
||||
<el-dialog :title="form.id ? '编辑' : '添加'" :visible.sync="dialogVisible" @close="reset">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="left">
|
||||
<el-form-item label="类型" v-if="!form.releId">
|
||||
<el-radio-group v-model="form.type">
|
||||
<el-radio :label="item.value" v-for="item in typeList" :key="item.value">{{ item.label }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="字典名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入分类名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="字典描述" prop="value">
|
||||
<el-input v-model="form.value" placeholder="请输入分类名称"></el-input>
|
||||
<el-form-item label="字典描述" prop="description">
|
||||
<el-input v-model="form.description" placeholder="请输入分类名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="字典标签" prop="dictName">
|
||||
<el-input v-model="form.dictName" placeholder="请输入分类名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-switch v-model="form.status" :active-value="1" :inactive-value="0"></el-switch>
|
||||
<!-- <el-form-item label="开关">
|
||||
<el-switch
|
||||
v-model="form.isShow"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序">
|
||||
<el-input-number v-model="form.sort" controls-position="right" :min="0"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-input-number
|
||||
v-model="form.sort"
|
||||
controls-position="right"
|
||||
:min="0"
|
||||
></el-input-number>
|
||||
</el-form-item> -->
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="onSubmitHandle">确 定</el-button>
|
||||
<el-button type="primary" @click="onSubmitHandle">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -35,31 +38,13 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
loading: false,
|
||||
form: {
|
||||
id: "",
|
||||
releId: '',
|
||||
pid: "",
|
||||
dictName: "",
|
||||
value: "",
|
||||
name: "",
|
||||
type: 'common',
|
||||
status: 1,
|
||||
sort: 0
|
||||
description: "",
|
||||
name: ""
|
||||
},
|
||||
typeList: [
|
||||
{
|
||||
value: 'common',
|
||||
label: '通用'
|
||||
},
|
||||
{
|
||||
value: 'home',
|
||||
label: '首页'
|
||||
},
|
||||
{
|
||||
value: 'hot',
|
||||
label: '热销'
|
||||
}
|
||||
],
|
||||
resetForm: "",
|
||||
rules: {
|
||||
dictName: [
|
||||
@@ -69,7 +54,7 @@ export default {
|
||||
trigger: "blur"
|
||||
}
|
||||
],
|
||||
value: [
|
||||
description: [
|
||||
{
|
||||
required: true,
|
||||
message: " ",
|
||||
@@ -91,12 +76,11 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
onSubmitHandle() {
|
||||
console.log(this.form);
|
||||
this.$refs.form.validate(async valid => {
|
||||
if (valid) {
|
||||
try {
|
||||
this.loading = true
|
||||
this.form.shopId = localStorage.getItem("shopId");
|
||||
this.form.releId && (this.form.type = '')
|
||||
let res = await dict(this.form, this.form.id ? "put" : "post");
|
||||
this.$emit("success", res);
|
||||
this.close();
|
||||
@@ -105,7 +89,6 @@ export default {
|
||||
message: `${this.form.id ? "编辑" : "添加"}成功`,
|
||||
type: "success"
|
||||
});
|
||||
this.loading = false
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
@@ -116,7 +99,7 @@ export default {
|
||||
// console.log(obj)
|
||||
this.dialogVisible = true;
|
||||
if (obj && obj.pid) {
|
||||
this.form.releId = obj.pid;
|
||||
this.form.pid = obj.pid;
|
||||
}
|
||||
if (obj && obj.id) {
|
||||
this.form = { ...obj };
|
||||
|
||||
@@ -20,21 +20,16 @@
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.list" v-loading="tableData.loading" row-key="id"
|
||||
:tree-props="{ children: 'dictDetails' }">
|
||||
<!-- <el-table-column type="index" width="50"></el-table-column> -->
|
||||
<el-table-column label="名称" prop="name"></el-table-column>
|
||||
<el-table-column label="描述" prop="value"></el-table-column>
|
||||
<el-table-column label="标签" prop="dictName"></el-table-column>
|
||||
<el-table-column label="状态" prop="status">
|
||||
<template v-slot="scope">
|
||||
<el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0"
|
||||
@change="changeHot($event, scope.row)"></el-switch>
|
||||
</template>
|
||||
:tree-props="{ children: 'childrenList' }">
|
||||
<el-table-column type="index" width="50">
|
||||
</el-table-column>
|
||||
<el-table-column label="名称" prop="name"></el-table-column>
|
||||
<el-table-column label="描述" prop="description"></el-table-column>
|
||||
<el-table-column label="标签" prop="dictName"></el-table-column>
|
||||
<el-table-column label="操作" width="300">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" size="mini" round icon="el-icon-plus"
|
||||
@click="$refs.addRef.show({ pid: scope.row.id })" v-if="!scope.row.releId">添加下级字典</el-button>
|
||||
@click="$refs.addRef.show({ pid: scope.row.id })" v-if="!scope.row.pid">添加下级字典</el-button>
|
||||
<el-button type="text" size="mini" round icon="el-icon-edit"
|
||||
@click="$refs.addRef.show(scope.row)">编辑</el-button>
|
||||
<el-popconfirm title="确定删除吗?" @confirm="delHandle([scope.row.id])">
|
||||
@@ -55,7 +50,7 @@
|
||||
|
||||
<script>
|
||||
import add from "./components/add";
|
||||
import { dict, dictPut } from "@/api/setting";
|
||||
import { dict } from "@/api/setting";
|
||||
export default {
|
||||
components: {
|
||||
add
|
||||
@@ -76,16 +71,8 @@ export default {
|
||||
this.getTableData();
|
||||
},
|
||||
methods: {
|
||||
// 切换状态
|
||||
async changeHot(e, row) {
|
||||
try {
|
||||
this.tableData.loading = true
|
||||
await dictPut({ ...row })
|
||||
this.getTableData()
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 添加子分类
|
||||
addChildGatgory(row) { },
|
||||
// 查询table
|
||||
toQuery() {
|
||||
this.getTableData();
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
<template>
|
||||
<el-dialog :title="form.id ? '编辑' : '添加'" :visible.sync="dialogVisible" @close="reset">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="left">
|
||||
<el-form-item label="字典名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入分类名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-switch v-model="form.status" :active-value="1" :inactive-value="0"></el-switch>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="排序">
|
||||
<el-input-number v-model="form.sort" controls-position="right" :min="0"></el-input-number>
|
||||
</el-form-item> -->
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="onSubmitHandle">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { tbCouponCategoryPostPut } from "@/api/setting";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
loading: false,
|
||||
form: {
|
||||
id: "",
|
||||
name: "",
|
||||
status: 1
|
||||
},
|
||||
rules: {
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
message: " ",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
},
|
||||
resetForm: "",
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.resetForm = { ...this.form };
|
||||
},
|
||||
methods: {
|
||||
onSubmitHandle() {
|
||||
this.$refs.form.validate(async valid => {
|
||||
if (valid) {
|
||||
try {
|
||||
this.loading = true
|
||||
let res = await tbCouponCategoryPostPut(this.form, this.form.id ? "put" : "post");
|
||||
this.$emit("success", res);
|
||||
this.close();
|
||||
this.$notify({
|
||||
title: "成功",
|
||||
message: `${this.form.id ? "编辑" : "添加"}成功`,
|
||||
type: "success"
|
||||
});
|
||||
this.loading = false
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
show(obj) {
|
||||
this.dialogVisible = true;
|
||||
if (obj && obj.id) {
|
||||
this.form = { ...obj };
|
||||
}
|
||||
},
|
||||
close() {
|
||||
this.dialogVisible = false;
|
||||
},
|
||||
reset() {
|
||||
this.form = { ...this.resetForm };
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user