Compare commits

...

129 Commits
master ... gyj

Author SHA1 Message Date
GYJ c39792a0f6 活动页面增加自定义充值金额开关 2024-08-20 10:24:14 +08:00
duan 44e15448d9 耗材列表盘点 2024-08-17 16:05:41 +08:00
duan ce546e09b2 修改所属商品字段 2024-08-16 15:22:29 +08:00
duan b3a48a68af 售卖时间管控 2024-08-15 16:04:22 +08:00
duan 611194b587 售卖时间管控 2024-08-15 15:50:43 +08:00
duan 0bccf5db8a 总的统计未携带分类参数 2024-08-15 13:47:08 +08:00
duan 3b7dbe50a2 将耗材记录加入到耗材列表里 2024-08-14 16:02:52 +08:00
duan 1e52030f5e 通知中心 2024-08-12 15:54:16 +08:00
duan b1bf21ccad 图库修改样式 2024-08-09 16:48:58 +08:00
魏啾 681d1c2c07 选择耗材 2024-08-09 15:01:58 +08:00
魏啾 7733dcf4e9 Merge branch 'dev' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into wwz 2024-08-09 14:06:16 +08:00
魏啾 5fc9443a4b 选择耗材 2024-08-09 14:06:02 +08:00
duan 2292bd6b82 Merge branch 'dev' of e.coding.net:g-cphe0354/yinshoukeguanliduan/management into dwb 2024-08-09 11:17:21 +08:00
duan 25b348ee12 修改样式 2024-08-09 11:17:10 +08:00
魏啾 14462f98ab 更改总数数量 2024-08-09 10:54:27 +08:00
duan b6b80c3d43 修改图片 2024-08-09 09:48:06 +08:00
duan c4b734ce12 优化样式 2024-08-08 14:28:45 +08:00
duan 69b19bfade 修改添加商品问题 2024-08-08 14:23:10 +08:00
duan 8c0ca8869a 图片样式优化 2024-08-08 11:27:54 +08:00
duan 4ab685fac3 编辑商品的问题 2024-08-08 10:50:33 +08:00
魏啾 87d2f8a7bb Merge branch 'dev' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into wwz 2024-08-08 09:38:35 +08:00
魏啾 81f5c68fa7 出库入库修改 2024-08-08 09:38:23 +08:00
duan 9a55093516 商品单规格和多规格之间切换 2024-08-08 09:11:20 +08:00
duan 3b12a2ba06 更改图库功能 2024-08-07 15:51:33 +08:00
duan 7f54c59092 图库上传bug 2024-08-07 11:44:05 +08:00
duan 5377a76365 修改图库BUG 2024-08-07 09:41:13 +08:00
魏啾 d0cc82fdf5 Merge branch 'dev' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into wwz 2024-08-07 09:12:00 +08:00
duan d1ef6fefa0 修改BUG 2024-08-06 17:56:29 +08:00
duan 6c4e992283 商品分页 2024-08-06 15:05:29 +08:00
duan 0971b67010 添加商品列表分页功能 2024-08-06 15:00:49 +08:00
duan 1d39576b34 商品列表-商品图片-选择图片增删改 2024-08-06 13:45:06 +08:00
魏啾 e38545be2d 交班时间 营业时间 2024-08-05 17:01:34 +08:00
魏啾 79e1282c68 11 2024-08-05 15:12:49 +08:00
gyq e67e3525e4 Merge branch 'dev' of e.coding.net:g-cphe0354/yinshoukeguanliduan/management into gyq 2024-08-03 18:11:19 +08:00
gyq 7427e2d913 耗材盘点传参更新,新增stockNumber 2024-08-03 18:11:14 +08:00
YeMingfei666 01c4c17d30 进销存商品绑定耗材已选择耗材后展示为黑色文字 2024-08-03 17:03:59 +08:00
gyq 671159277c 交班记录新增sort字段 2024-08-03 16:55:20 +08:00
gyq b495926968 1.新增修改密码 2.取消出入库供应商校验 2024-08-03 16:49:57 +08:00
duan 6830529769 提出报错插件 2024-08-02 15:15:42 +08:00
gyq 4a6c0ca71d Merge branch 'dev' of e.coding.net:g-cphe0354/yinshoukeguanliduan/management into gyq 2024-08-02 15:12:08 +08:00
gyq 07551be485 更新商品设置热门 2024-08-02 15:11:27 +08:00
duan 64d321508e Merge branch 'dev' of e.coding.net:g-cphe0354/yinshoukeguanliduan/management into dwb 2024-08-02 15:06:51 +08:00
duan d8cac655a4 图库选择50% 2024-08-02 15:06:35 +08:00
duan 9a75cb474e 修改热门接口参数 2024-08-02 15:04:43 +08:00
gyq 744632324b 优化起售数量最低1 2024-08-02 10:41:44 +08:00
gyq 0a1af58fcd 优化编辑商品 2024-08-01 15:52:33 +08:00
duan 5bc744872b 拉取DEV代码 2024-08-01 15:50:15 +08:00
duan 2acf054b86 素材库添加-未完成 2024-08-01 15:48:45 +08:00
gyq 7de5f566b0 优化商品编辑 2024-08-01 15:29:30 +08:00
gyq 4818e2e927 Merge branch 'dev' of e.coding.net:g-cphe0354/yinshoukeguanliduan/management into gyq 2024-07-30 16:00:13 +08:00
gyq 5d3fdd5acf 登录新增类型 2024-07-30 16:00:08 +08:00
魏啾 c505674e36 Merge branch 'dev' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into wwz 2024-07-30 15:46:26 +08:00
魏啾 20ed539215 交班记录 2024-07-30 15:46:14 +08:00
魏啾 9317ec1dfa 交班记录 2024-07-30 15:46:02 +08:00
gyq d8b9d01aa7 进销存-操作出库记录中的耗材出库记录现有库存字段精度显示小数位数过多 2024-07-30 13:51:04 +08:00
gyq 77f75bbbeb 修复出入库类型错误 2024-07-29 17:47:57 +08:00
gyq bf0da42707 1.限制添加员工优惠金额最大10W 2024-07-29 15:04:26 +08:00
gyq f6a37259bb 添加员工,角色修改为必填项 2024-07-29 13:32:41 +08:00
YeMingfei666 8d5a54fe6f 添加商品页面增加商品备注,增加批量修改范围限制,修复批量修改时数据变化视图未更新问题 2024-07-26 14:12:41 +08:00
YeMingfei666 432ba32b4e Merge branch 'dev' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into ymf 2024-07-26 13:43:08 +08:00
YeMingfei666 0ce365bbe8 进销存-商品库存-详情记录增加规格名称 2024-07-26 13:42:49 +08:00
gyq 502a18d5a3 添加员工设置密码 2024-07-26 11:14:59 +08:00
gyq b88ae01878 Merge branch 'dev' of e.coding.net:g-cphe0354/yinshoukeguanliduan/management into gyq 2024-07-26 09:46:33 +08:00
gyq 617dd317d3 店铺管理新增员工列表 2024-07-26 09:46:25 +08:00
YeMingfei666 b08e7edfa2 Merge branch 'dev' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into dev 2024-07-25 14:57:27 +08:00
YeMingfei666 fa84f836ed Merge branch 'ymf' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into dev 2024-07-25 14:57:01 +08:00
duan ee5178ccfe 上架多规格的子集没有, 2024-07-25 14:55:01 +08:00
YeMingfei666 a7c2194ec2 去除在保留两位小数时的四舍五入 2024-07-25 14:35:09 +08:00
YeMingfei666 3ea8aeab34 Merge branch 'ymf' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into dev 2024-07-25 13:59:57 +08:00
YeMingfei666 79a0a2c1a2 去除添加商品打包费,虚拟销量输入时的最小值为0限制,改为输入完成后验证 2024-07-25 13:56:53 +08:00
YeMingfei666 6aea8a9c8e 优化-增加商品添加时数字输入框如果输入值超范围时重置数据的弹窗提醒 2024-07-25 13:52:30 +08:00
YeMingfei666 0122589289 Merge branch 'ymf' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into dev 2024-07-25 11:33:38 +08:00
YeMingfei666 51c9c9e15c Merge branch 'dev' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into ymf 2024-07-25 11:33:07 +08:00
YeMingfei666 016ebf7b62 商品管理-商品列表增加商品时对价格金额数量进行限制和数字格式化 2024-07-25 11:32:37 +08:00
duan dbe8167822 Merge branch 'dev' of e.coding.net:g-cphe0354/yinshoukeguanliduan/management into dwb 2024-07-24 17:04:04 +08:00
duan a6d3d4afbe 多规格上架按钮隐藏 2024-07-24 17:03:41 +08:00
YeMingfei666 54d06b72fe 修改商品管理-商品分组编辑商品分组后未将id置空问题 2024-07-24 10:54:53 +08:00
YeMingfei666 347f58828d 修改进销存操作记录,当返回数据不包含number字段时返回空字符串 2024-07-24 09:22:45 +08:00
YeMingfei666 72778ed68b 进销存操作记录修改回根据后台返回数据计算 2024-07-23 18:30:11 +08:00
YeMingfei666 3532d8dbf4 更改进销存操作记录为后台返回subType值,根据改值判断加减 2024-07-23 18:18:32 +08:00
YeMingfei666 c1beec0efc 优化耗材管理绑定商品页面同商品不同规格绑定耗材时未重置选中耗材 2024-07-23 18:09:43 +08:00
YeMingfei666 3ae0d7991b Merge branch 'dev' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into ymf 2024-07-23 17:21:53 +08:00
YeMingfei666 496389f8bc 修改耗材管理-绑定商品绑定耗材提交的数据结构,修改筛选耗材输入id为选择分类 2024-07-23 17:21:00 +08:00
gyq aa7a672e87 Merge branch 'dev' of e.coding.net:g-cphe0354/yinshoukeguanliduan/management into gyq 2024-07-23 17:12:16 +08:00
gyq dcb2eb36ea 优化编辑商品起售数量不显示和库存数量显示不准确 2024-07-23 17:12:11 +08:00
duan 04d23793d1 Merge branch 'dev' of e.coding.net:g-cphe0354/yinshoukeguanliduan/management into dwb 2024-07-23 17:03:26 +08:00
duan 6cbf407b88 扩展资料 2024-07-23 17:03:16 +08:00
YeMingfei666 a6d90bf36e Merge branch 'ymf' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into dev 2024-07-23 15:03:07 +08:00
YeMingfei666 7b679fb415 修复在查询耗材流水信息里时返回的商品id为null时报错导致耗材记录列表不显示的情况 2024-07-23 15:01:25 +08:00
duan 6f15f226ee Merge branch 'dev' of e.coding.net:g-cphe0354/yinshoukeguanliduan/management into dev 2024-07-23 10:16:10 +08:00
duan 1ca47334f6 优化问题 2024-07-23 10:15:30 +08:00
gyq 52ed7edf08 优化出库入库数量限制 2024-07-22 17:13:44 +08:00
duan 2be2df7bc4 上架 2024-07-22 14:24:13 +08:00
duan e335d634da Merge branch 'dev' of e.coding.net:g-cphe0354/yinshoukeguanliduan/management into dev 2024-07-22 13:59:25 +08:00
duan fa27401152 上架 2024-07-22 13:59:09 +08:00
duan 29affe432a 盘点备注 2024-07-22 13:57:12 +08:00
YeMingfei666 9479f1c987 Merge branch 'ymf' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into dev 2024-07-22 13:50:35 +08:00
YeMingfei666 30b309dcf3 增加耗材分类名称禁止输入空格 2024-07-22 13:49:33 +08:00
duan 3ea683b7bd 合并 2024-07-22 13:34:32 +08:00
duan aaea042bca Merge branch 'dev' of e.coding.net:g-cphe0354/yinshoukeguanliduan/management into dev 2024-07-22 10:32:49 +08:00
YeMingfei666 4bffe64149 Merge branch 'ymf' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into dev 2024-07-22 10:22:58 +08:00
YeMingfei666 9de4251981 操作入库选择多规格商品后商品名称后面追加规格名称 2024-07-22 10:22:23 +08:00
duan 33e2e7b761 扩展参数 2024-07-22 10:10:15 +08:00
YeMingfei666 dd7f4c32ac Merge branch 'ymf' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into dev 2024-07-20 18:33:50 +08:00
YeMingfei666 ecf800bf76 更新耗材修改单位 2024-07-20 18:33:18 +08:00
YeMingfei666 a059e97a45 Merge branch 'ymf' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into dev 2024-07-20 18:22:51 +08:00
YeMingfei666 000def6dc2 更新修改耗材信息提交数据格式 2024-07-20 18:22:11 +08:00
YeMingfei666 a53c688513 Merge branch 'ymf' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into dev 2024-07-20 17:59:27 +08:00
YeMingfei666 949a310c71 更新样式 2024-07-20 17:58:59 +08:00
YeMingfei666 fb63eabb33 Merge branch 'ymf' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into dev 2024-07-20 17:49:42 +08:00
YeMingfei666 a427cfff76 修复耗材记录服务器上居中失效 2024-07-20 17:49:11 +08:00
YeMingfei666 f3faa70c59 Merge branch 'ymf' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into dev 2024-07-20 17:43:59 +08:00
YeMingfei666 015ca6ae4e 更新耗材记录所属商品 2024-07-20 17:41:54 +08:00
YeMingfei666 bb2e166af2 更新耗材 2024-07-20 17:35:55 +08:00
YeMingfei666 97685234d4 耗材记录增加所属商品,样式居中 2024-07-20 17:33:30 +08:00
YeMingfei666 914a6389e7 删除测试数据 2024-07-20 17:31:53 +08:00
YeMingfei666 1a4eb34824 订单列表增加备注 2024-07-20 15:53:05 +08:00
YeMingfei666 3888b95248 删除耗材类型代码 2024-07-20 15:16:38 +08:00
gyq fcae02fe4a Merge branch 'dev' of e.coding.net:g-cphe0354/yinshoukeguanliduan/management into gyq 2024-07-19 18:21:03 +08:00
gyq 63effa002d 优化 2024-07-19 18:20:57 +08:00
YeMingfei666 f13dbd580a 增加耗材单位 2024-07-19 17:56:50 +08:00
YeMingfei666 58bf05d7c4 修改部分样式 2024-07-19 09:04:36 +08:00
YeMingfei666 cc32bc79a3 修改选择耗材弹窗样式 2024-07-18 18:16:23 +08:00
YeMingfei666 e7ff989d03 修复样式问题 2024-07-18 18:05:18 +08:00
YeMingfei666 2f0006571f 修改耗材绑定商品 2024-07-18 17:31:38 +08:00
YeMingfei666 5d0bbba194 耗材修改 2024-07-17 18:28:18 +08:00
duan 7cadb25712 从商品库存-库存记录-点击订单号跳转过来 2024-07-17 18:06:13 +08:00
duan cfa32e18ba 安全信息保存后重置 2024-07-15 10:35:35 +08:00
魏啾 abe786d155 page 改为30 2024-07-14 11:04:06 +08:00
59 changed files with 6658 additions and 1209 deletions

View File

@ -13,4 +13,5 @@ VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn'
# VUE_APP_BASE_API = 'http://192.168.2.147:8000/'
VUE_APP_WS_API = 'ws://192.168.2.128:8000'
VUE_APP_PHP_API = 'https://kysh.sxczgkj.cn'
# 是否启用 babel-plugin-dynamic-import-node插

View File

@ -8,4 +8,6 @@ VUE_APP_BASE_API = 'https://admintestpapi.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_WS_API = 'wss://123.56.110.252'
VUE_APP_PHP_API = 'https://kysh.sxczgkj.cn/source'

View File

@ -39,6 +39,7 @@
"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",

View File

@ -39,12 +39,19 @@ export function puttbConsType(data) {
* @returns
*/
export function gettbConsInfo(params) {
// return request({
// url: '/api/tbConsInfo',
// method: "get",
// params
// });
return request({
url: '/api/tbConsInfo',
url: "/api/viewConInfoFlow",
method: "get",
params
});
params
});
}
/**
* 耗材入库
* @returns
@ -163,4 +170,58 @@ export function gettbConsInfoFlow(params) {
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
}
});
}

58
src/api/extend.js Normal file
View File

@ -0,0 +1,58 @@
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
});
}

14
src/api/homes/record.js Normal file
View File

@ -0,0 +1,14 @@
import request from '@/utils/request'
/**
* 查询交班记录
* @returns
*/
export function tbHandoverGet(leng) {
return request({
url: leng,
method: 'get'
})
}

57
src/api/imagesPhp.js Normal file
View File

@ -0,0 +1,57 @@
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
},
})
}

View File

@ -241,6 +241,16 @@ export function stockStateChange(params) {
}
});
}
// 下架
export function stockStateChangess(params) {
return request({
url: `/api/stock/grounding`,
method: "put",
params: {
...params
}
});
}
// 警戒设置
export function stockStatewarnLine(params) {
return request({

View File

@ -1,35 +1,43 @@
import request from '@/utils/request'
import request from "@/utils/request";
export function login(username, password, code, uuid) {
export function login(data) {
return request({
url: 'auth/login',
method: 'post',
data: {
username,
password,
code,
uuid
}
})
url: "auth/login",
method: "post",
data
});
}
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'
})
url: "auth/logout",
method: "delete"
});
}
/**
* 个人中心 修改密码
* @param {*} data
* @returns
*/
export function updatePass(data) {
return request({
url: "/api/users/updatePass",
method: "post",
data
});
}

42
src/api/notifications.js Normal file
View File

@ -0,0 +1,42 @@
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
})
}

View File

@ -428,7 +428,14 @@ export function findActivate(params) {
params
});
}
// 获取店铺会员二维码
export function getwxacode(data) {
return request({
url: `/shop/storage/getwxacode`,
method: "post",
data
});
}
/**
* 商家用户列表
* @returns
@ -458,7 +465,6 @@ export function queryAllShopInfo(params) {
});
}
/**
* 修改商品排序
* @returns
@ -495,7 +501,6 @@ export function upCategorySort(data) {
});
}
/**
* 查询店铺充值记录
* @returns
@ -519,10 +524,86 @@ export function downloadTableRecharge(data) {
return request({
url: `/api/tbShopUser/recharge/download`,
method: "post",
data:{
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
});
}

View File

@ -36,7 +36,7 @@ export default {
dialogImageUrl: '',
dialogVisible: false,
fileList: [],
files: [],
// files: [],
headers: {
'Authorization': getToken()
}
@ -45,7 +45,13 @@ export default {
methods: {
handleSuccess(response, file, fileList) {
// console.log('', response)
this.files = response.data
setTimeout(() => {
this.fileList.push({
url: response.data[0],
id: response.data.id
})
}, 100);
// this.files = response.data
this.$emit('success', response.data)
},
//
@ -69,6 +75,9 @@ 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() {
@ -76,4 +85,11 @@ export default {
}
}
}
</script>
</script>
<style>
.el-upload-list__item {
transition: none;
}
</style>

View File

@ -33,6 +33,11 @@
个人中心
</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>
退出登录
@ -41,6 +46,32 @@
</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>
@ -53,6 +84,8 @@ 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: {
@ -64,11 +97,61 @@ 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')
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'
}
]
}
}
},
computed: {
@ -91,6 +174,36 @@ 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')
},

View File

@ -6,6 +6,11 @@ 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 dict from "./components/Dict";
import Editor from "@/components/Editor";

View File

@ -58,6 +58,12 @@ export const constantRouterMap = [
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: '交班记录' }
}
]
},

View File

@ -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,91 +13,98 @@ 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.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)
setToken(res.token, rememberMe)
commit('SET_TOKEN', res.token)
setUserInfo(res.user, commit)
// 第一次加载菜单时用到, 具体见 src 目录下的 permission.js
commit('SET_LOAD_MENUS', true)
resolve()
}).catch(error => {
reject(error)
})
})
login(userInfo)
.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);
// 第一次加载菜单时用到, 具体见 src 目录下的 permission.js
commit("SET_LOAD_MENUS", true);
resolve();
})
.catch(error => {
reject(error);
});
});
},
// 获取用户信息
GetInfo({ commit }) {
return new Promise((resolve, reject) => {
getInfo().then(res => {
setUserInfo(res, commit)
resolve(res)
}).catch(error => {
reject(error)
})
})
getInfo()
.then(res => {
setUserInfo(res, commit);
resolve(res);
})
.catch(error => {
reject(error);
});
});
},
// 登出
LogOut({ commit }) {
return new Promise((resolve, reject) => {
logout().then(res => {
logOut(commit)
resolve()
}).catch(error => {
logOut(commit)
reject(error)
})
})
logout()
.then(res => {
logOut(commit);
resolve();
})
.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;

30
src/utils/format.js Normal file
View File

@ -0,0 +1,30 @@
/**
* 格式化价格函数将价格限定在指定的最小值和最大值范围内并保留两位小数
*
* @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
}

93
src/utils/requestPhp.js Normal file
View File

@ -0,0 +1,93 @@
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

View File

@ -214,7 +214,9 @@ export default {
try {
const res = await daycount({
startTime: this.query.createdAt[0],
endTime: this.query.createdAt[1]
endTime: this.query.createdAt[1],
cateId: this.query.cateId,
proName: this.query.proName
});
this.payCountList = res;
} catch (error) {

View File

@ -0,0 +1,384 @@
<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>

View File

@ -87,11 +87,11 @@
</el-table-column>
</el-table> -->
</div>
<div class="head-container">
<!-- <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> -->
</div>
</template>

View File

@ -1,68 +1,36 @@
<!-- 新增耗材盘点 -->
<!-- 耗材列表的新增耗材盘点 -->
<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 :value="detail.num" readonly style="width: 180px;"></el-input>
</el-form-item>
<el-form-item label="实际数量">
<el-input-number
v-model="form.lpNum"
:min="0"
:step="1"
step-strictly
style="width: 180px;"
></el-input-number>
</el-form-item>
<el-form-item label="盈亏数量">
<el-input
:value="profitNumber"
readonly
:class="{ lose: profitNumber < 0 }"
style="width: 180px;"
></el-input>
</el-form-item>
<el-form-item label="单价">
<el-input v-model="detail.price" readonly></el-input>
</el-form-item>
<el-form-item label="盈亏金额">
<el-input
:value="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">
<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;">
@ -70,188 +38,165 @@
<i class="icon el-icon-document-delete"></i>
</div>
</el-image>
<span>{{ scope.row.name }}</span>
<span>{{ scope.row.conName }}</span>
</div>
</template>
</el-table-column> -->
<el-table-column label="售价" prop="price">
<template v-slot="scope">
{{ formatDecimal(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">
{{ formatDecimal(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="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>
</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";
import { formatDecimal } from '@/utils'
import { tbConCheck, tbConCheckGet } from '@/api/invoicing'
export default {
data() {
return {
formatDecimal,
dialogVisible: false,
loading: false,
detail: "",
form: {
conInfoId: "",
lpNum: 0
},
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 formatDecimal(this.form.lpNum - this.detail.num, 2, true);
},
profitPrice() {
return formatDecimal(
(this.form.lpNum - this.detail.num) * this.detail.price
);
}
},
methods: {
onSubmitHandle() {
this.$refs.form.validate(async valid => {
if (valid) {
try {
this.loading = true;
let res = await tbConCheck({
conInfoId: this.form.conInfoId,
lpNum: this.profitNumber
});
this.detail.num = this.form.lpNum;
this.form.lpNum = 0;
this.form.lpNum = this.detail.num;
this.$emit("success", res);
this.loading = false;
this.$message({
title: "注意",
message: `添加成功`,
type: "success"
});
this.getTableData();
} catch (error) {
this.loading = false;
console.log(error);
}
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: []
}
}
});
},
show(obj) {
// console.log(obj);
this.detail = { ...obj };
this.detail.num = formatDecimal(
obj.stockNumber - obj.stockConsume,
2,
false
);
this.dialogVisible = true;
this.form.conInfoId = obj.id;
this.form.lpNum = this.detail.num;
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.proId;
this.tableData.page = 0;
this.tableData.total = 0;
this.tableData.list = [];
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,
conInfoId: this.form.conInfoId,
sort: "id,desc"
});
this.tableData.list = res.content;
this.tableData.total = res.totalElements;
setTimeout(() => {
this.tableData.loading = false;
}, 500);
} catch (error) {
console.log(error);
}
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);
}
&::v-deep .el-input__inner {
color: rgb(238, 29, 29);
}
}
.shop_info {
display: flex;
align-items: center;
display: flex;
align-items: center;
span {
margin-left: 10px;
}
span {
margin-left: 10px;
}
}
</style>
</style>

View File

@ -0,0 +1,174 @@
<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>

View File

@ -3,13 +3,13 @@
<el-dialog title="选择耗材" :visible.sync="dialogVisible" @open="resetHandle()">
<el-form :model="searchForm" inline>
<el-form-item>
<el-input v-model="searchForm.conTypeName" placeholder="耗材类型名称"></el-input>
<el-input v-model="searchForm.conTypeName" placeholder="耗材类型名称" @input="onInput"></el-input>
</el-form-item>
<el-form-item>
<el-input v-model="searchForm.conCode" placeholder="耗材代码"></el-input>
<el-input v-model="searchForm.conCode" placeholder="耗材代码" @input="onInput"></el-input>
</el-form-item>
<el-form-item>
<el-input v-model="searchForm.conName" placeholder="耗材名称"></el-input>
<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>
@ -17,7 +17,8 @@
</el-form-item>
</el-form>
<div class="head-container">
<el-table ref="table" :data="tableData.list" v-loading="tableData.loading" @select="firstSelectChange">
<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>
@ -50,6 +51,8 @@
<script>
import { formatDecimal } from '@/utils'
import { tbConsInfoGet } from "@/api/invoicing";
import _ from 'lodash'
export default {
data() {
return {
@ -69,13 +72,23 @@ export default {
loading: false,
list: []
},
goods: []
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
@ -84,10 +97,16 @@ export default {
this.$refs.table.toggleRowSelection(del_row, false);
}
},
//
confirmHandle() {
let res = this.$refs.table.selection
this.$emit('success', res)
// 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()
},
//

View File

@ -24,6 +24,11 @@
</div>
<div class="head-container">
<el-table :data="tableData.list" v-loading="tableData.loading">
<el-table-column label="规格名称" prop="specSnap" v-if="goods.specSnap">
<template v-slot="scope">
<span v-if="scope.row.specSnap"> {{ scope.row.specSnap }}</span>
</template>
</el-table-column>
<el-table-column label="类型">
<template v-slot="scope">
<el-tag type="info">{{ scope.row.type }}</el-tag>
@ -43,6 +48,13 @@
{{ 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>
</template>
</el-table-column>
<el-table-column label="操作时间" prop="updatedAt">
<template v-slot="scope">
{{ dayjs(scope.row.updatedAt).format('YYYY-MM-DD HH:mm:ss') }}
@ -112,6 +124,9 @@ 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 = ''
@ -124,6 +139,7 @@ export default {
async show(obj) {
this.dialogVisible = true
this.goods = obj
console.log(obj)
this.tbProductStockDetailSum()
await this.getTableData()
},

View File

@ -33,6 +33,7 @@
<script>
import dayjs from 'dayjs'
import { formatDecimal } from '@/utils/index.js'
import { tbProductStockOperateDetail } from '@/api/invoicing'
export default {
data() {
@ -54,7 +55,11 @@ export default {
methods: {
//
returnNowHasNumbr(row) {
return row.stockNumber * 1 + row.number * 1 + row.unitName
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) {
this.dialogVisible = true
@ -67,6 +72,7 @@ export default {
const res = await tbProductStockOperateDetail(id)
this.tableData.loading = false
this.tableData.detail = res
} catch (error) {
console.log(error);
}

View File

@ -0,0 +1,250 @@
<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>

View File

@ -2,7 +2,7 @@
<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-input v-model="searhForm.name" placeholder="商品名称" @input="onInput"></el-input>
</el-form-item>
<el-form-item>
<el-select v-model="searhForm.category" placeholder="商品分类">
@ -16,8 +16,9 @@
</el-form-item>
</el-form>
<div class="head-container">
<el-table ref="table" :data="tableData.list" @select="firstSelectChange" v-loading="tableData.loading">
<el-table-column type="selection" width="55" align="center"></el-table-column>
<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">
@ -68,7 +69,7 @@
<script>
import { tbShopCategoryGet, tbProductlist } from "@/api/invoicing";
import _ from 'lodash'
export default {
data() {
return {
@ -87,12 +88,21 @@ export default {
},
goods: [],
//
isselect: false
isselect: false,
stayselection: []//
}
},
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();
@ -101,8 +111,11 @@ export default {
},
//
confirmHandle() {
let res = this.$refs.table.selection
this.$emit('success', res)
// 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()
},
//

View File

@ -0,0 +1,621 @@
<!-- 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") // 00
.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>

View File

@ -0,0 +1,105 @@
<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>

View File

@ -0,0 +1,239 @@
<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>

View File

@ -20,20 +20,43 @@
height="66vh"
>
<el-table-column label="耗材名称" prop="conName" />
<el-table-column label="变动库存" prop="amount">
<el-table-column label="现有库存" >
<template v-slot="scope">
<span :class="{ red: scope.row.bizType == '-' }"
>{{ scope.row.bizType }}{{ scope.row.amount }}</span
<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="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') }}
@ -57,12 +80,19 @@
"
/>
</div>
<cons-record-detail ref="recodeDetail"></cons-record-detail>
</div>
</template>
<script>
import { gettbConsInfoFlow } from "@/api/consumable";
import { gettbConsInfoFlow,viewConInfoFlow } from "@/api/consumable";
import consRecordDetail from "../components/cons_record_detail";
export default {
components:{
consRecordDetail
},
data() {
return {
query: {
@ -81,6 +111,27 @@ export default {
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;
@ -99,15 +150,29 @@ export default {
async getTableData() {
try {
this.clickseetableData.loading = true;
const res = await gettbConsInfoFlow({
const res = await viewConInfoFlow({
page: this.clickseetableData.page,
size: this.clickseetableData.size,
consId: "",
conName: this.query.conName,
...this.query,
shopId: localStorage.getItem("shopId")
});
this.clickseetableData.loading = false;
this.clickseetableData.data = res.content;
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);
@ -116,3 +181,23 @@ export default {
}
};
</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>

View File

@ -0,0 +1,362 @@
<!-- 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>

View File

@ -4,19 +4,36 @@
<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;"
<!-- <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.conTypeName" size="small" clearable placeholder="请输入类型名称" style="width: 150px;"
<el-input v-model="query.conCode" size="small" clearable placeholder="请输入耗材代码" style="width: 150px"
@keyup.enter.native="getTableData" />
<el-input v-model="query.conCode" size="small" clearable placeholder="请输入耗材代码" style="width: 150px;"
<el-input v-model="query.conName" 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%;">
<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>
@ -35,38 +52,77 @@
</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" />
<el-table-column label="耗材代码" prop="conCode" />
<!-- <el-table-column label="类型id" prop="conTypeId" /> -->
<el-table-column label="分类名称" prop="conTypeName" />
<el-table-column label="单位" prop="conUnit" />
<el-table-column label="创建时间" prop="createTime" width="200">
<!-- <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">
{{ dayjs(scope.row.createTime).format("YYYY-MM-DD HH:mm:ss") }}
<span :class="[computedClass(scope.row.balance)]"> {{ scope.row.balance }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="最近入库量" prop="lasterInStock" /> -->
<el-table-column label="库存数量" prop="stockNumber">
<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">
{{ (scope.row.stockNumber - scope.row.stockConsume).toFixed(2) }}
<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="conWarning" />
<!-- <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="更新时间" prop="updateTime" width="200">
<el-table-column label="创建时间" align="center" prop="createTime" width="200">
<!-- <template v-slot="scope">
{{ dayjs(scope.row.createdAt).format('YYYY-MM-DD HH:mm:ss') }}
{{ dayjs(scope.row.createTime).format("YYYY-MM-DD HH:mm:ss") }}
</template> -->
</el-table-column>
<el-table-column label="操作" width="180" fixed="right">
<!-- <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;"
<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> -->
@ -81,7 +137,7 @@
</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 => {
layout="total, sizes, prev, pager, next, jumper" @current-change="paginationChange" @size-change="(e) => {
tableData.size = e;
tableData.page = 0;
getTableData();
@ -94,25 +150,33 @@
<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-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="70%">
<el-form :inline="true" ref="refruleForm" :model="ruleForm" :rules="rules" class="demo-form-inline">
<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
<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 == '添加'"
@ -123,50 +187,115 @@
disabled
></el-input>
</el-form-item>-->
<!-- <el-form-item v-if="dialogtitle == '添加'">
<!-- <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-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="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-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-item style="display: flex;justify-content: flex-end;">
</el-form>
</div>
<div style="display: flex; justify-content: flex-end">
<el-button @click="dialogshow = false"> </el-button>
<el-button type="primary" @click="submitForm('refruleForm')">
<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>
<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" />
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%;">
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;">
<div style="margin-top: 10px">
<el-button type="primary" @click="getTableDatatype">查询</el-button>
<el-button @click="resetHandletype">重置</el-button>
</div>
@ -220,12 +349,18 @@
<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() }" />
@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" />
@ -237,7 +372,18 @@
import Sortable from "sortablejs";
import dayjs from "dayjs";
import settings from "@/settings";
import { upProSort } from "@/api/shop";
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,
@ -250,8 +396,10 @@ 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 },
components: { AddConsTakin, UploadExcel, consRecordDetail },
data() {
return {
dayjs,
@ -316,6 +464,7 @@ export default {
total: 0
},
ruleFormLoading: false,
ruleForms: [],
ruleForm: {
conCode: "",
conName: "",
@ -336,7 +485,7 @@ export default {
{ required: true, message: "请输入耗材信息名称", trigger: "blur" }
],
conTypeId: [
{ required: true, message: "请选择耗材类型", trigger: "blur" }
{ required: true, message: "请选择耗材类型", trigger: "change" }
],
price: [{ required: true, message: "请输入耗材价格", trigger: "blur" }],
conWarning: [
@ -362,10 +511,49 @@ export default {
},
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 {
@ -381,6 +569,22 @@ export default {
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 {
@ -399,7 +603,8 @@ export default {
for (let key in this.ruleForm) {
this.ruleForm[key] = row[key];
}
this.ruleForm.id = row.id;
console.log(row, '调试1')
this.ruleForm.id = row.consId;
this.dialogshow = true;
},
//
@ -428,9 +633,24 @@ export default {
shopId: localStorage.getItem("shopId")
});
this.tableData.loading = false;
this.tableData.data = res.content;
// 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);
}
@ -509,11 +729,12 @@ export default {
this.dialogtitle = "添加";
this.gettbConsType()
this.$nextTick(() => {
this.$refs.refruleForm.resetFields();
// this.$refs.refruleForm.resetFields();
this.resetRuleForms()
});
} else {
this.dialogtitle = "编辑";
this.ruleForm.id = item.id;
this.ruleForm.id = item.consId;
this.ruleForm.conTypeId = item.conTypeId;
this.ruleForm.conCode = item.conCode;
this.ruleForm.conName = item.conName;
@ -523,21 +744,52 @@ export default {
}
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 == "编辑") {
await postapitbConsInfo(this.ruleForm);
console.log(this.ruleForm, '调试 ')
await postapitbConsInfo([this.ruleForm]);
this.$message({ type: "success", message: "编辑成功" });
this.dialogshow = false;
} else {
//
console.log(this.ruleForm, '调试')
await posttbConsInfo({
...this.ruleForm
});
this.$message({ type: "success", message: "添加成功" });
// //
// 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();
@ -590,6 +842,18 @@ export default {
</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;

File diff suppressed because it is too large Load Diff

View File

@ -77,11 +77,11 @@
<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" />
<el-input v-model="ruleForm.conTypeName" @input="trimInput($event,'conTypeName')"/>
</el-form-item>
<el-form-item label="耗材类型代码" prop="conTypeCode">
<!-- <el-form-item label="耗材类型代码" prop="conTypeCode">
<el-input v-model="ruleForm.conTypeCode" />
</el-form-item>
</el-form-item> -->
<el-form-item label="是否禁用" prop="status">
<el-switch v-model="ruleForm.status" />
</el-form-item>
@ -153,6 +153,10 @@ export default {
})
},
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')
@ -242,7 +246,7 @@ export default {
this.getTableData()
} else {
await posttbConsType({
conTypeCode: this.ruleForm.conTypeCode,
// conTypeCode: this.ruleForm.conTypeCode,
conTypeName: this.ruleForm.conTypeName,
shopId: this.ruleForm.shopId,
status: this.ruleForm.status ? '0' : '1'

View File

@ -17,6 +17,11 @@
<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-button type="primary" @click="getTableData">查询</el-button>
<el-button @click="resetHandle">重置</el-button>
<el-button @click="Uppop()">库存预警:{{ warnLine }}</el-button>
@ -82,12 +87,19 @@
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="">
</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">
<template v-slot="scope">
<el-button type="text" size="mini"
@ -128,7 +140,7 @@
</template>
<script>
import { stock, stockdownload, stockdoImport, stockStatewarnLine, stockStateChanges, stocks } from '@/api/invoicing'
import { stock, stockdownload, stockdoImport, stockStatewarnLine, stockStateChanges, stocks, stockStateChangess } from '@/api/invoicing'
import { tbShopCategoryGet } from '@/api/shop'
import settings from '@/settings'
import invoicingDetail from './components/invoicingDetail'
@ -148,6 +160,7 @@ export default {
montey: "",
categorys: [],
query: {
sort: "", //
name: '',
isStock: '',
num: '',
@ -226,7 +239,7 @@ export default {
const file = await stockdownload({
name: this.query.name,
isStock: this.query.isStock,
num: this.query.num
num: this.query.num,
})
downloadFile(file, "商品库存", "xlsx");
this.downloadLoading = false;
@ -280,6 +293,18 @@ export default {
}
},
//
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 {
@ -290,6 +315,7 @@ export default {
isStock: this.query.isStock,
num: this.query.num,
categoryId: this.query.categoryId,
sort:this.query.sort,
shopId: localStorage.getItem('shopId')
})
this.tableData.loading = false

View File

@ -13,7 +13,7 @@
</div>
</div>
</el-form-item>
<el-form-item label="入库类型" v-if="inTabValue == 'goods'">
<!-- <el-form-item label="入库类型" v-if="inTabValue == 'goods'">
<div class="shop_type_box">
<div class="item" v-for="(item, index) in shopTypes" :key="index"
:class="{ active: shopTypesActive == index }" @click="changeTypeEnum(index)">
@ -34,11 +34,12 @@
</div>
</div>
</div>
</el-form-item>
</el-form-item> -->
<el-row>
<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-col :span="8">
<el-form-item label="供应商">
<el-select v-model="queryForm.purveyorId" placeholder="请选择供应商" clearable
style="width: 220px;" @change="changeTypeEnum">
<el-option :label="item.purveyorName" :value="item.id" v-for="item in purveyorList"
:key="item.id"></el-option>
</el-select>
@ -93,6 +94,10 @@
v-if="inTabValue == 'consumable'">选择耗材</el-button>
<el-button type="primary" @click="$refs.shopList.show(tableData.list)" v-else>选择商品</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">
@ -113,14 +118,15 @@
<el-table-column label="进价">
<template v-slot="scope">
<el-input-number v-model="scope.row.price" :min="0" controls-position="right"
@change="consCountTotal()"></el-input-number>
@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" controls-position="right"
@change="consCountTotal()"></el-input-number>
<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>
@ -140,7 +146,8 @@
</el-table-column> -->
<el-table-column label="操作" width="80">
<template v-slot="scope">
<el-button type="text" @click="tableData.list.splice(scope.$index, 1)">删除</el-button>
<el-button type="text"
@click="tableData.list.splice(scope.$index, 1), spliceclick()">删除</el-button>
</template>
</el-table-column>
</el-table>
@ -150,6 +157,7 @@
<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> -->
</div>
</template>
@ -157,14 +165,15 @@
<el-table-column label="进价">
<template v-slot="scope">
<el-input-number v-model="scope.row.costPrice" :min="0" controls-position="right"
@change="e => { modifyPrice(); scope.row.costPrice = e }"></el-input-number>
@change="modifyPrice($event, scope.row, 'costPrice')"></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="e => { modifyPrice(); scope.row.totalAmount = e }"></el-input-number>
<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>
<div class="tips">入库前{{ scope.row.stockNumber }}{{ scope.row.unitName }}</div>
</template>
</el-table-column>
@ -182,7 +191,8 @@
</el-table-column>
<el-table-column label="操作" width="80">
<template v-slot="scope">
<el-button type="text" @click="tableData.list.splice(scope.$index, 1)">删除</el-button>
<el-button type="text"
@click="tableData.list.splice(scope.$index, 1), spliceclick()">删除</el-button>
</template>
</el-table-column>
</el-table>
@ -212,6 +222,7 @@
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'
export default {
@ -235,7 +246,7 @@ export default {
type: 'in'
}
],
shopTypesActive: 0,
shopTypesActive: 1,
shopTypes: [
{
label: '供应商入库',
@ -287,7 +298,10 @@ export default {
tableData: {
list: []
},
showResult: false
showResult: false,
autocompletename: '',
restaurants: [],
timeout: null
}
},
mounted() {
@ -295,32 +309,145 @@ 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])
}
},
//
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) {
let arr = []
res.forEach(item => {
item.skuList.forEach(i => {
arr.push({
name: item.name,
unitName: item.unitName,
productId: item.id,
number: 0,
totalAmount: '',
...i
})
})
})
this.tableData.list = [...this.tableData.list, ...arr]
},
//
tabChange(value, type) {
console.log(type);
this.shopTypesActive = type == 'in' ? 0 : 1
this.inTabValue = value
this.shopTypesActive = 0
this.resetHandle()
this.queryForm.type = type
this.$refs.shopList.clearSelection()//
this.$refs.ConsumableList.clearSelection()//
},
//
consCountTotal() {
let zong = 0
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() {
let zong = 0
this.tableData.list.forEach(ele => {
zong += ele.costPrice * ele.number
})
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 {
@ -343,6 +470,8 @@ export default {
}
this.queryFormLoading = false
this.showResult = true
this.$refs.shopList.clearSelection()//
this.$refs.ConsumableList.clearSelection()//
} catch (error) {
console.log(error)
this.queryFormLoading = false
@ -352,43 +481,44 @@ export default {
},
//
selectConsumable(res) {
this.tableData.list = res.map(item => {
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 = []
res.forEach(item => {
item.skuList.forEach(i => {
arr.push({
name: item.name,
unitName: item.unitName,
productId: item.id,
number: 0,
totalAmount: '',
...i
})
})
})
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()
this.$refs.queryForm.resetFields()
},
//
changeTypeEnum(index) {
this.shopTypesActive = index
this.queryForm.type = this.shopTypes[index].value
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
},
//
async tbShopPurveyorGet() {

View File

@ -13,7 +13,7 @@
</div>
</div>
</el-form-item>
<el-form-item label="出库类型" v-if="inTabValue == 'goods'">
<!-- <el-form-item label="出库类型" v-if="inTabValue == 'goods'">
<div class="shop_type_box">
<div class="item" v-for="(item, index) in shopTypes" :key="index"
:class="{ active: shopTypesActive == index }" @click="changeTypeEnum(index)">
@ -34,11 +34,12 @@
</div>
</div>
</div>
</el-form-item>
</el-form-item> -->
<el-row>
<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-col :span="8">
<el-form-item label="供应商">
<el-select clearable v-model="queryForm.purveyorId" placeholder="请选择供应商"
style="width: 220px;" @change="changeTypeEnum">
<el-option :label="item.purveyorName" :value="item.id" v-for="item in purveyorList"
:key="item.id"></el-option>
</el-select>
@ -93,6 +94,11 @@
v-if="inTabValue == 'consumable'">选择耗材</el-button>
<el-button type="primary" @click="$refs.shopList.show(tableData.list)" v-else>选择商品</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">
@ -110,14 +116,15 @@
<el-table-column label="进价">
<template v-slot="scope">
<el-input-number v-model="scope.row.price" :min="0" controls-position="right"
@change="consCountTotal()"></el-input-number>
@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" controls-position="right"
@change="consCountTotal()"></el-input-number>
<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>
@ -136,7 +143,8 @@
</el-table-column> -->
<el-table-column label="操作" width="80">
<template v-slot="scope">
<el-button type="text" @click="tableData.list.splice(scope.$index, 1)">删除</el-button>
<el-button type="text"
@click="tableData.list.splice(scope.$index, 1), spliceclick()">删除</el-button>
</template>
</el-table-column>
</el-table>
@ -153,14 +161,14 @@
<el-table-column label="进价">
<template v-slot="scope">
<el-input-number v-model="scope.row.costPrice" :min="0" controls-position="right"
@change="e => { modifyPrice(); scope.row.costPrice = e }"></el-input-number>
@change="modifyPrice($event, scope.row, 'costPrice')"></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="e => { modifyPrice(); scope.row.totalAmount = e }"></el-input-number>
@change="modifyPrice($event, scope.row, 'number', 'totalAmount')"></el-input-number>
<div class="tips">出库前{{ scope.row.stockNumber }}{{ scope.row.unitName }}</div>
</template>
</el-table-column>
@ -178,7 +186,8 @@
</el-table-column>
<el-table-column label="操作" width="80">
<template v-slot="scope">
<el-button type="text" @click="tableData.list.splice(scope.$index, 1)">删除</el-button>
<el-button type="text"
@click=" tableData.list.splice(scope.$index, 1), spliceclick()">删除</el-button>
</template>
</el-table-column>
</el-table>
@ -208,7 +217,8 @@
import dayjs from 'dayjs'
import shopList from './components/shopList'
import ConsumableList from './components/consumableList'
import { tbShopPurveyorGet, tbProductStockOperateOutAndOn, stockInOut } from '@/api/invoicing'
import { tbShopPurveyorGet, tbProductStockOperateOutAndOn, stockInOut, tbConsInfoGet, tbProductlist } from '@/api/invoicing'
import { formatDecimal } from '@/utils'
export default {
components: {
@ -231,7 +241,7 @@ export default {
type: 'out'
}
],
shopTypesActive: 0,
shopTypesActive: 1,
shopTypes: [
{
label: '供应商退货',
@ -283,7 +293,10 @@ export default {
tableData: {
list: []
},
showResult: false
showResult: false,
autocompletename: '',
restaurants: [],
timeout: null
}
},
mounted() {
@ -291,31 +304,130 @@ 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 = 0
this.shopTypesActive = 1
this.resetHandle()
this.queryForm.type = type
this.$refs.shopList.clearSelection()//
this.$refs.ConsumableList.clearSelection()//
},
//
consCountTotal() {
let zong = 0
this.tableData.list.forEach(ele => {
zong += ele.price * ele.stockNumber
})
//
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() {
let zong = 0
this.tableData.list.forEach(ele => {
zong += ele.costPrice * ele.number
})
this.queryForm.totalAmount = 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 {
@ -339,6 +451,8 @@ export default {
}
this.queryFormLoading = false
this.showResult = true
this.$refs.shopList.clearSelection()//
this.$refs.ConsumableList.clearSelection()//
} catch (error) {
console.log(error)
this.queryFormLoading = false
@ -348,13 +462,14 @@ export default {
},
//
selectConsumable(res) {
this.tableData.list = res.map(item => {
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) {
@ -371,20 +486,30 @@ export default {
})
})
})
console.log(arr)
this.tableData.list = arr
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()
},
//
changeTypeEnum(index) {
this.shopTypesActive = index
this.queryForm.type = this.shopTypes[index].value
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
},
//
async tbShopPurveyorGet() {

View File

@ -5,6 +5,17 @@
<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" />
@ -27,9 +38,11 @@
</div>
</div>
</el-form-item>
<el-checkbox v-model="loginForm.rememberMe" style="margin:0 0 25px 0;">
记住我
</el-checkbox>
<!-- <el-form-item>
<el-checkbox v-model="loginForm.rememberMe">
记住我
</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">
@ -66,12 +79,15 @@ export default {
password: '',
rememberMe: false,
code: '',
uuid: ''
uuid: '',
merchantName: '',
loginType: 'merchant'
},
loginRules: {
username: [{ required: true, trigger: 'blur', message: '用户名不能为空' }],
password: [{ required: true, trigger: 'blur', message: '密码不能为空' }],
code: [{ required: true, trigger: 'change', message: '验证码不能为空' }]
code: [{ required: true, trigger: 'change', message: '验证码不能为空' }],
merchantName: [{ required: true, trigger: 'change', message: '商户号不能为空' }]
},
loading: false,
redirect: undefined
@ -95,10 +111,10 @@ export default {
created() {
//
this.getCode()
// Cookie
this.getCookie()
// token
this.point()
// // Cookie
// this.getCookie()
// // token
// this.point()
},
methods: {
getCode() {
@ -119,32 +135,39 @@ export default {
username: username === undefined ? this.loginForm.username : username,
password: password,
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe),
code: ''
code: '',
merchantName: '',
loginType: 'merchant'
}
},
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
}
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,
// merchantName: this.loginForm.merchantName,
// loginType: this.loginForm.loginType
// }
// 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')
}
// 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)
this.$store.dispatch('Login', user).then(() => {
this.loading = false
this.$router.push({ path: this.redirect || '/' })
@ -217,10 +240,12 @@ export default {
text-align: center;
color: #bfbfbf;
}
.code_wrap {
display: flex;
justify-content: space-between;
}
.login-code {
width: 33%;
display: inline-block;

View File

@ -10,11 +10,7 @@
<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>
@ -22,11 +18,7 @@
<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>
@ -42,35 +34,35 @@
<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">
@ -112,20 +104,12 @@
<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.refundNumber">(退 - {{ item.refundNumber }})</span>
</div>
<div class="sku">{{ item.productSkuName }}</div>
</div>
@ -134,15 +118,12 @@
</template>
</el-table-column>
<el-table-column label="台桌号" prop="tableName"></el-table-column>
<el-table-column label="订单金额">
<el-table-column label="订单金额">
<template v-slot="scope">
<div>{{ scope.row.orderType | orderTypeFilter }}</div>
<div
class="refund"
v-if="
scope.row.orderType == 'return'
"
>
<div class="refund" v-if="
scope.row.orderType == 'return'
">
退款-{{ scope.row.orderAmount }}
</div>
<div v-else>{{ scope.row.orderAmount }}</div>
@ -150,11 +131,9 @@
</el-table-column>
<el-table-column label="状态">
<template v-slot="scope">
<template
v-if="
scope.row.status == 'refund' && scope.row.orderType != 'return'
"
>
<template v-if="
scope.row.status == 'refund' && scope.row.orderType != 'return'
">
<el-tag type="primary">已完成</el-tag>
</template>
<template v-else>
@ -167,6 +146,7 @@
</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 }}
@ -174,22 +154,15 @@
</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>
@ -218,7 +191,8 @@ export default {
status: "",
payType: "",
orderNo: "",
createdAt: []
createdAt: [],
productName:''
},
tableData: {
data: [],
@ -232,6 +206,7 @@ export default {
payCountTotal: 0
};
},
filters: {
orderTypeFilter(t) {
if (t) {
@ -259,12 +234,22 @@ export default {
}
},
mounted() {
if(this.$route.query.tableName){
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: {
//
@ -320,11 +305,13 @@ 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
...this.query,
productName
});
this.tableData.loading = false;
this.tableData.data = res.content;

View File

@ -2,7 +2,8 @@
<div class="app-container">
<el-form ref="formRef" :model="form" :rules="rules" label-width="140px" label-position="left">
<el-form-item label="商品类型" prop="typeEnum">
<div class="shop_type_box" :class="{ disabled: form.id }">
<div class="shop_type_box" :class="{}">
<!-- <div class="shop_type_box" :class="{ disabled: form.id }"> -->
<div class="item" v-for="(item, index) in shopTypes" :key="index"
:class="{ active: shopTypesActive == index }" @click="changeTypeEnum(index)">
<div class="s_title">{{ item.label }}</div>
@ -16,7 +17,10 @@
<el-form-item label="商品名称" prop="name">
<el-input v-model="form.name" placeholder="请输入商品名称" style="width: 500px;"></el-input>
</el-form-item>
<el-form-item label="单位">
<el-form-item label="商品介绍" prop="shortTitle">
<el-input v-model="form.shortTitle" type="textarea" placeholder="请输入商品介绍" style="width: 500px;"></el-input>
</el-form-item>
<el-form-item label="单位" prop="unitId">
<el-select v-model="form.unitId" placeholder="请选择单位" style="width: 500px;" @change="selectUnitt">
<el-option :label="item.name" :value="item.id" v-for="item in units" :key="item.id"></el-option>
</el-select>
@ -42,8 +46,19 @@
<addClassify ref="addClassifyRef" @success="tbShopCategoryGet" />
</el-form-item>
<el-form-item label="商品图片">
<uploadImg ref="uploadImg" :limit="9" @success="uploadSuccess" @remove="uploadRemove" />
<div style="display: flex;flex-wrap: wrap; ">
<div v-for="item in imgList" style="position: relative;" class="showStyle">
<i class="el-icon-error buttonstyle" @click="deleteEvent(item)"></i>
<img style="width: 148px;height: 148px;margin-right: 6px;" class="imgStyle" :key="item.id" :src="item.url"
alt="">
</div>
<div class="upImgStyle" @click="$refs.addImg.show()">
+
</div>
</div>
<!-- <uploadImg ref="uploadImg" :limit="9" @success="uploadSuccess" @remove="uploadRemove" /> -->
<div class="tips">第一张图为商品封面图图片尺寸为750×750</div>
<!-- <el-button type="primary" plain icon="el-icon-plus" @click="$refs.addImg.show()">选择图片</el-button> -->
</el-form-item>
<el-form-item label="套餐商品" v-if="shopTypes[shopTypesActive].typeEnum == 'group'">
<el-table :data="form.groupSnap" border v-if="form.groupSnap.length">
@ -88,41 +103,48 @@
<el-table :data="form.skuList" border>
<el-table-column label="售价" prop="salePrice">
<template v-slot="scope">
<el-input-number v-model="scope.row.salePrice" controls-position="right"></el-input-number>
<el-input-number @change="priceFormat(scope.row, 'salePrice')" @blur="priceFormat(scope.row, 'salePrice')"
v-model="scope.row.salePrice" controls-position="right"></el-input-number>
</template>
</el-table-column>
<el-table-column label="会员价" prop="memberPrice">
<template v-slot="scope">
<el-input-number v-model="scope.row.memberPrice" controls-position="right"></el-input-number>
<el-input-number @change="priceFormat(scope.row, 'memberPrice')"
@blur="priceFormat(scope.row, 'memberPrice')" v-model="scope.row.memberPrice"
controls-position="right"></el-input-number>
</template>
</el-table-column>
<el-table-column label="成本价" prop="costPrice">
<template v-slot="scope">
<el-input-number v-model="scope.row.costPrice" controls-position="right"></el-input-number>
<el-input-number @change="priceFormat(scope.row, 'costPrice')" @blur="priceFormat(scope.row, 'costPrice')"
v-model="scope.row.costPrice" controls-position="right"></el-input-number>
</template>
</el-table-column>
<el-table-column label="原价" prop="originPrice">
<template v-slot="scope">
<el-input-number v-model="scope.row.originPrice" controls-position="right"></el-input-number>
<el-input-number @change="priceFormat(scope.row, 'originPrice')"
@blur="priceFormat(scope.row, 'originPrice')" v-model="scope.row.originPrice"
controls-position="right"></el-input-number>
</template>
</el-table-column>
<!-- <el-table-column label="起售数量" prop="suit">
<el-table-column label="起售数量" prop="suit">
<template slot-scope="scope">
<el-input-number
v-model="scope.row.suit"
controls-position="right"
></el-input-number>
<el-input-number @change="priceFormat(scope.row, 'suit')" @blur="priceFormat(scope.row, 'suit')" :min="1"
v-model="scope.row.suit" controls-position="right"></el-input-number>
</template>
</el-table-column> -->
</el-table-column>
<el-table-column label="库存数量" prop="stockNumber">
<template v-slot="scope">
<el-input-number v-model="scope.row.stockNumber" :disabled="!!form.id"
<el-input-number @change="priceFormat(scope.row, 'stockNumber')"
@blur="priceFormat(scope.row, 'stockNumber')" v-model="scope.row.stockNumber" :disabled="!!form.id"
controls-position="right"></el-input-number>
</template>
</el-table-column>
<el-table-column label="分销金额" prop="firstShared">
<template v-slot="scope">
<el-input-number v-model="scope.row.firstShared" controls-position="right"></el-input-number>
<el-input-number @change="priceFormat(scope.row, 'firstShared')"
@blur="priceFormat(scope.row, 'firstShared')" v-model="scope.row.firstShared"
controls-position="right"></el-input-number>
</template>
</el-table-column>
<el-table-column label="商品条码">
@ -131,9 +153,9 @@
</template>
</el-table-column>
</el-table>
<div class="tips" v-if="form.isShowMall">
<!-- <div class="tips" v-if="form.isShowMall">
小程序商城必须设置库存数量大于0
</div>
</div> -->
</el-form-item>
<template v-if="form.typeEnum == 'group'">
<el-form-item label="使用日期说明" prop="notices.dateUsed">
@ -195,6 +217,7 @@
<uploadImg type="text" :limit="1" @success="res => (scope.row.coverImg = res[0])"
v-if="!scope.row.coverImg" />
<el-image style="width:30px;height:30px;" :src="scope.row.coverImg" v-else />
<i class="el-icon-error " v-if="scope.row.coverImg" @click="scope.row.coverImg = ''"></i>
</template>
</el-table-column>
<el-table-column label="售价" prop="salePrice">
@ -203,7 +226,8 @@
<i class="icon el-icon-edit" @click="batchNumber('salePrice')"></i>
</template>
<template slot-scope="scope">
<el-input-number v-model="scope.row.salePrice" controls-position="right"></el-input-number>
<el-input-number @change="priceFormat(scope.row, 'salePrice')" @blur="priceFormat(scope.row, 'salePrice')"
v-model="scope.row.salePrice" controls-position="right"></el-input-number>
</template>
</el-table-column>
<el-table-column label="会员价" prop="memberPrice">
@ -212,7 +236,9 @@
<i class="icon el-icon-edit" @click="batchNumber('memberPrice')"></i>
</template>
<template slot-scope="scope">
<el-input-number v-model="scope.row.memberPrice" controls-position="right"></el-input-number>
<el-input-number @change="priceFormat(scope.row, 'memberPrice')"
@blur="priceFormat(scope.row, 'memberPrice')" v-model="scope.row.memberPrice"
controls-position="right"></el-input-number>
</template>
</el-table-column>
<el-table-column label="成本价" prop="costPrice">
@ -221,7 +247,8 @@
<i class="icon el-icon-edit" @click="batchNumber('costPrice')"></i>
</template>
<template slot-scope="scope">
<el-input-number v-model="scope.row.costPrice" controls-position="right"></el-input-number>
<el-input-number @change="priceFormat(scope.row, 'costPrice')" @blur="priceFormat(scope.row, 'costPrice')"
v-model="scope.row.costPrice" controls-position="right"></el-input-number>
</template>
</el-table-column>
<el-table-column label="原价" prop="originPrice">
@ -230,28 +257,29 @@
<i class="icon el-icon-edit" @click="batchNumber('originPrice')"></i>
</template>
<template slot-scope="scope">
<el-input-number v-model="scope.row.originPrice" controls-position="right"></el-input-number>
<el-input-number @change="priceFormat(scope.row, 'originPrice')"
@blur="priceFormat(scope.row, 'originPrice')" v-model="scope.row.originPrice"
controls-position="right"></el-input-number>
</template>
</el-table-column>
<!-- <el-table-column label="起售数量" prop="suit">
<el-table-column label="起售数量" prop="suit">
<template slot="header" slot-scope="scope">
<span>起售数量</span>
<i class="icon el-icon-edit" @click="batchNumber('suit')"></i>
</template>
<template slot-scope="scope">
<el-input-number
v-model="scope.row.suit"
controls-position="right"
></el-input-number>
<el-input-number @change="priceFormat(scope.row, 'originsuitrice')" @blur="priceFormat(scope.row, 'suit')"
v-model="scope.row.suit" controls-position="right" :min="1"></el-input-number>
</template>
</el-table-column> -->
</el-table-column>
<el-table-column label="库存数量" prop="stockNumber">
<template slot="header" slot-scope="scope">
<span>库存数量</span>
<i class="icon el-icon-edit" @click="batchNumber('stockNumber')" v-if="!form.id"></i>
</template>
<template slot-scope="scope">
<el-input-number v-model="scope.row.stockNumber" :disabled="!!scope.row.id"
<el-input-number @change="priceFormat(scope.row, 'stockNumber')"
@blur="priceFormat(scope.row, 'stockNumber')" v-model="scope.row.stockNumber" :disabled="!!scope.row.id"
controls-position="right"></el-input-number>
</template>
</el-table-column>
@ -261,7 +289,9 @@
<i class="icon el-icon-edit" @click="batchNumber('firstShared')"></i>
</template>
<template slot-scope="scope">
<el-input-number v-model="scope.row.firstShared" controls-position="right"></el-input-number>
<el-input-number @change="priceFormat(scope.row, 'firstShared')"
@blur="priceFormat(scope.row, 'firstShared')" v-model="scope.row.firstShared"
controls-position="right"></el-input-number>
</template>
</el-table-column>
<el-table-column label="商品条码">
@ -279,9 +309,9 @@
</template>
</el-table-column> -->
</el-table>
<div class="tips" v-if="form.isShowMall">
<!-- <div class="tips" v-if="form.isShowMall">
小程序商城必须设置库存数量大于0
</div>
</div> -->
</el-form-item>
<template v-if="form.typeEnum != 'group'">
<el-form-item label="上架区域">
@ -309,13 +339,15 @@
<div class="tips">开启后: 收银完成后会自动打印对应数量的标签数</div>
</el-form-item>
<el-form-item label="打包费">
<el-input-number v-model="form.packFee" controls-position="right" :min="0"></el-input-number>
<el-input-number @change="priceFormat(form, 'packFee')" @blur="priceFormat(form, 'packFee')"
v-model="form.packFee" controls-position="right"></el-input-number>
<div class="tips">
单份商品打包费店铺开启外卖模式下该数据才生效
</div>
</el-form-item>
<el-form-item label="虚拟销量">
<el-input-number v-model="form.baseSalesNumber" controls-position="right" :min="0"></el-input-number>
<el-input-number @change="priceFormat(form, 'baseSalesNumber')" @blur="priceFormat(form, 'baseSalesNumber')"
v-model="form.baseSalesNumber" controls-position="right"></el-input-number>
</el-form-item>
</template>
<el-form-item label="排序" v-if="form.id">
@ -329,8 +361,9 @@
<el-dialog title="批量修改" width="400px" :visible.sync="showBatchModal">
<el-form :model="batchNumberForm">
<el-form-item>
<el-input-number v-model="batchNumberForm.batchNumber" :min="0" controls-position="right"
style="width: 100%;"></el-input-number>
<el-input-number @change="priceFormat(batchNumberForm, 'batchNumber')"
@blur="priceFormat(batchNumberForm, 'batchNumber')" v-model="batchNumberForm.batchNumber"
controls-position="right" style="width: 100%;"></el-input-number>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
@ -340,6 +373,8 @@
</el-dialog>
<!-- 选择团购券分类 -->
<groupTypeList ref="groupTypeList" @success="res => (form.groupCategoryId = res)" />
<!-- 选择图片 -->
<addImg ref='addImg' @successEvent="successEvent"></addImg>
</div>
</template>
@ -354,6 +389,7 @@ import {
tbProductPut
} from "@/api/shop";
import addUnit from "./components/addUnit";
import addImg from './components/addImages.vue'
import addClassify from "./components/addClassify";
import shopList from "@/components/shopList";
import groupTypeList from "@/components/groupTypeList";
@ -361,6 +397,7 @@ import uploadImg from "@/components/uploadImg";
import settings from "@/settings";
import dayjs from "dayjs";
import { RandomNumBoth } from "@/utils";
import { formatPrice } from "@/utils/format";
export default {
components: {
@ -369,7 +406,7 @@ export default {
uploadImg,
shopList,
groupTypeList,
Editor
Editor, addImg
},
data() {
const validatordateUsed = (rule, value, callback) => {
@ -397,7 +434,10 @@ export default {
stockNumber: 0,
firstShared: 0,
barCode: `${localStorage.getItem("shopId")}${dayjs().valueOf()}`,
// suit: 1
isGrounding: 1,
productId: this.$route.query.goods_id,
shopId: localStorage.getItem("shopId"),
suit: 0
},
tableAddShopIndex: null,
isEditor: false,
@ -407,6 +447,7 @@ export default {
id: "",
typeEnum: "normal",
name: "",
shortTitle: "",//
unitId: "",
unitName: "",
categoryId: "", // id
@ -441,6 +482,7 @@ export default {
usageRules: ""
}
},
imgList: [],
rules: {
typeEnum: [
{
@ -454,6 +496,11 @@ export default {
message: "请输入商品名称"
}
],
unitId: [{
required: true,
trigger: "change",
message: "请选择单位"
}],
categoryId: [
{
required: true,
@ -517,6 +564,49 @@ export default {
}
},
methods: {
successEvent(d) {
this.form.images.push(d[0].url);
this.imgList.push(d[0])
// if (this.$refs.uploadImg.fileList.length < 9) {
// d.forEach(item => {
// item.uid = item.id
// item.url = item.url
// this.form.images.push(item.url);
// })
// this.$refs.uploadImg.fileList.push(...d)
// console.log(this.$refs.uploadImg.fileList, '1')
// } else {
// this.$notify.error({
// title: '',
// message: '9'
// });
// }
},
priceFormat(item, key) {
const messageheight = 48;
const offset = window.innerHeight / 2 - (messageheight / 2) - 100
this.$nextTick(() => {
const min = 0;
const max = 100000000;
const newval = formatPrice(item[key], min, max, true)
console.log(newval)
if (typeof newval !== 'number') {
item[key] = newval.value
this.$message({
offset,
message: `请输入${min}${max}范围内的数字`,
type: "error"
});
} else {
item[key] = newval
}
})
},
deleteEvent(d) {
let index = this.imgList.findIndex(ele => ele.url == d.url)
this.imgList.splice(index, 1);
},
//
delGoods(goods, index, $index) {
goods.splice(index, 1);
@ -542,8 +632,14 @@ export default {
},
//
batchNumberFormConfirm() {
this.form.skuList.map(item => {
item[this.batchNumberKey] = this.batchNumberForm.batchNumber;
console.log(this.form.skuList)
this.form.skuList.map((item, index) => {
//vue2
let newitem = { ...item }
newitem[this.batchNumberKey] = this.batchNumberForm.batchNumber;
this.$set(this.form.skuList, index, { ...newitem })
// item[this.batchNumberKey] = this.batchNumberForm.batchNumber;
});
this.showBatchModal = false;
this.batchNumberForm.batchNumber = 0;
@ -559,14 +655,17 @@ export default {
);
this.specTableHeaders = JSON.parse(res.specTableHeaders);
this.selectSpec = JSON.parse(res.selectSpec);
//
this.$refs.uploadImg.fileList = res.images.map(item => {
// this.$refs.uploadImg.fileList = res.images.map(item => {
// return {
// url: item
// };
// });
this.imgList = res.images.map(item => {
return {
url: item
};
});
this.form = res;
if (res.typeEnum == "sku") {
let skuList = [...res.skuList];
@ -575,11 +674,15 @@ export default {
this.form.skuList = skuList.map((item, index) => {
specInfo[index].id = item.id;
specInfo[index].productId = item.productId;
specInfo[index].realSalesNumber = item.productId;
specInfo[index].realSalesNumber = item.realSalesNumber;
specInfo[index].shopId = item.shopId;
specInfo[index].warnLine = item.warnLine;
specInfo[index].suit = item.suit;
specInfo[index].stockNumber = item.stockNumber;
specInfo[index].isGrounding = item.isGrounding;
return specInfo[index];
});
console.log(this.form.skuList);
this.originSkuList = [...this.form.skuList];
this.selectSpecResult = true;
}
@ -589,12 +692,16 @@ export default {
},
//
submitHandle() {
console.log("form", this.form);
let arr = []
this.imgList.forEach(ele => {
arr.push(ele.url)
})
this.$refs.formRef.validate(async faild => {
try {
if (faild) {
this.loading = true;
this.form.lowPrice = this.form.skuList[0].salePrice;
this.form.images = arr
this.form.lowPrice = this.form.skuList.length && this.form.skuList[0].salePrice;
this.form.coverImg = this.form.images[0];
this.form.selectSpec = JSON.stringify(this.selectSpec);
this.form.specTableHeaders = JSON.stringify(this.specTableHeaders);
@ -644,12 +751,12 @@ export default {
},
//
changeTypeEnum(index) {
if (this.form.id) return;
// if (this.form.id) return;
this.shopTypesActive = index;
const typeEnum = this.shopTypes[index].typeEnum;
this.form.typeEnum = typeEnum;
if (typeEnum == "sku") {
this.form.skuList = [];
this.tbProductSpecGet();
} else {
this.specId = "";
@ -665,6 +772,7 @@ export default {
},
//
uploadRemove(arr) {
this.form.images = arr;
},
//
@ -858,6 +966,18 @@ export default {
</script>
<style scoped lang="scss">
.upImgStyle {
cursor: pointer;
width: 148px;
height: 148px;
line-height: 148px;
text-align: center;
border: 1px dashed #ccc;
border-radius: 1%;
font-size: 30px;
color: #ccc;
}
.shop_list {
.item {
display: flex;
@ -913,4 +1033,20 @@ export default {
cursor: pointer;
}
}
.buttonstyle {
border-radius: 50%;
color: #db1616;
background-color: #fff;
font-size: 20px;
display: none;
position: absolute;
right: -10px;
top: -10px;
z-index: 10;
}
.showStyle:hover>.buttonstyle {
display: block;
}
</style>

View File

@ -26,13 +26,38 @@
<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.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-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 @click="quxiaodialogVisible"> </el-button>
<el-button type="primary" :loading="loading" @click="onSubmitHandle"> </el-button>
</span>
</el-dialog>
@ -57,8 +82,19 @@ 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: [
{
@ -66,12 +102,24 @@ 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 => {
@ -99,6 +147,7 @@ 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)
@ -128,12 +177,18 @@ 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
@ -145,6 +200,7 @@ export default {
this.form.isShow = 1
this.form.name = ''
this.form.sort = 0
this.form.id = null
this.form.productIds = []
this.productIds = []
}

View File

@ -0,0 +1,234 @@
<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>

View File

@ -0,0 +1,187 @@
<template>
<div style="">
<div style="text-align: right;" v-if="activedata == -1">
<span style="color: #aaa;">只能上传pngjgp图片</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>

View File

@ -0,0 +1,79 @@
<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>

View File

@ -10,6 +10,16 @@
<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="分组名称" 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"
@ -61,8 +71,22 @@ export default {
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')

View File

@ -53,6 +53,9 @@
<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">
@ -110,6 +113,7 @@ export default {
return {
dayjs,
query: {
productId: '',
name: '',
categoryId: '',
typeEnum: ''
@ -126,6 +130,12 @@ export default {
}
},
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) {
@ -166,11 +176,10 @@ export default {
},
//
async changeHot(e, row) {
console.log(row)
try {
this.tableData.loading = true
await tbProductIsHot({
shopId: localStorage.getItem('shopId'),
isHot: e,
id: row.id
})
this.getTableData()
@ -183,6 +192,7 @@ 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()
@ -196,16 +206,18 @@ export default {
async getTableData() {
try {
let localQuery = JSON.parse(localStorage.getItem('shopIndexQuery'))
if (localQuery != null) {
this.query = localQuery
if (localQuery != null && localQuery.hasOwnProperty('productId')) {
// this.query = localQuery
}
this.tableData.loading = true
console.log(this.query,'调试2')
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')
})

View File

@ -0,0 +1,180 @@
<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>

View File

@ -0,0 +1,196 @@
<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>

View File

@ -49,7 +49,16 @@ export default {
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'

View File

@ -69,7 +69,7 @@
}" format="HH:mm" value-format="HH:mm">
</el-time-picker>
<el-time-picker placeholder="结束时间" v-model="endTime" :picker-options="{
selectableRange: `${startTime}:00 - 23:59:59`
selectableRange:'00:00:00 - 23:59:59',
}" format="HH:mm" value-format="HH:mm">
</el-time-picker>
</el-form-item>

View File

@ -0,0 +1,177 @@
<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>

View File

@ -5,11 +5,14 @@
<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>
@ -19,12 +22,12 @@ 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
notice,securitySetting,extend
},
data() {
return {

View File

@ -0,0 +1,123 @@
<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>

View File

@ -15,6 +15,12 @@
<el-button type="primary" icon="el-icon-plus" @click="$refs.addActive.show()">
添加活动
</el-button>
<el-button type="primary" icon="el-icon-plus" @click="$refs.downloadQR.show()">
下载会员充值二维码
</el-button>
<div style="margin-top: 35px; font-size: 16px; color: #333;">
允许充值自定义金额<el-switch v-model="shopInfo.isCustom" active-value="1" inactive-value="0" size="large" @change="customStatusChange"></el-switch>
</div>
</div>
<div class="head-container">
<el-table :data="tableData.data" v-loading="tableData.loading">
@ -51,17 +57,20 @@
@current-change="paginationChange" layout="total"></el-pagination>
</div>
<addActive ref="addActive" @success="getTableData" />
<QR ref="downloadQR"></QR>
</div>
</template>
<script>
import handselTypes from './handselTypes'
import addActive from './components/addActive'
import QR from './components/downloadQR.vue'
import { findActivate, modityActivate } from '@/api/shop'
import { tbShopInfo, tbShopInfoPut } from "@/api/user";
import dayjs from 'dayjs'
export default {
components: {
addActive
addActive, QR
},
data() {
return {
@ -74,6 +83,9 @@ export default {
size: 10,
loading: false,
total: 0
},
shopInfo: {
isCustom: '0',
}
}
},
@ -87,6 +99,7 @@ export default {
},
mounted() {
this.getTableData()
this.getShopInfo()
},
methods: {
//
@ -126,7 +139,29 @@ export default {
} catch (error) {
console.log(error)
}
},
//
async getShopInfo() {
try {
const res = await tbShopInfo(localStorage.getItem('shopId'))
this.shopInfo = res
if (this.shopInfo.isCustom == null) {
this.shopInfo.isCustom = '0'
}
console.log(this.shopInfo);
} catch (error) {
console.log(error)
}
},
customStatusChange() {
this.updateShopInfo()
},
async updateShopInfo() {
await tbShopInfoPut(this.shopInfo)
}
}
}
</script>
</script>

View File

@ -0,0 +1,76 @@
<template>
<div class="downloadQR" v-show="isshow">
<div class="box">
<img :src="imgUrl" style="width: 300px;height: 300px;" alt="">
<div class="btnStyle">
<el-button type="primary" @click="isshow = false">取消</el-button>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a :href="imgUrl"><el-button type="primary" @click="downImg">下载</el-button></a>
</div>
</div>
</div>
</template>
<script>
import { getwxacode } from '@/api/shop'
export default {
data() {
return {
isshow: false,
imgUrl: ""
}
},
mounted() {
this.getlist()
},
methods: {
show() {
this.isshow = true
},
async getlist() {
let res = await getwxacode({
shopId: localStorage.getItem('shopId')
})
this.imgUrl = res
}, downImg() {
// window.location.href()
window.URL.revokeObjectURL(this.imgUrl)
}
}
}
</script>
<style scoped lang="scss">
.downloadQR {
display: flex;
justify-content: center;
align-items: center;
background-color: rgba($color: #000000, $alpha: .6);
width: 100%;
height: 100%;
position: fixed;
left: 0;
top: 0;
z-index: 9999;
.box {
padding: 20px;
border-radius: 3px;
height: 400px;
width: 340px;
background-color: #fff;
display: flex;
// align-items: center;
// justify-content: center;
flex-direction: column;
}
.btnStyle {
margin-top: 20px;
text-align: center;
}
}
</style>

View File

@ -3,10 +3,7 @@
<div class="head-container">
<el-form :model="query" inline>
<el-form-item label="搜索">
<el-input
v-model="query.name"
placeholder="请输入昵称或手机号"
></el-input>
<el-input v-model="query.name" placeholder="请输入昵称或手机号"></el-input>
</el-form-item>
<el-form-item label="是否为会员">
<el-select v-model="query.isVip" placeholder="是否是会员">
@ -43,9 +40,7 @@
<div class="n">{{ shopInfo.chageTotal || 0 }}</div>
</div>
<div class="item">
<el-button type="success" @click="toPage('charge')"
>充值记录</el-button
>
<el-button type="success" @click="toPage('charge')">充值记录</el-button>
<!-- <el-button type="danger" @click="toPage('cost')">消费记录</el-button> -->
</div>
</div>
@ -57,10 +52,7 @@
<el-table-column label="用户" prop="headImg" width="200px">
<template v-slot="scope">
<div class="user_info">
<el-image
:src="scope.row.headImg"
style="width: 40px;height: 40px;flex-shrink: 0;"
>
<el-image :src="scope.row.headImg" style="width: 40px;height: 40px;flex-shrink: 0;">
<div slot="error" class="image-slot">
<i class="el-icon-user"></i>
</div>
@ -76,24 +68,16 @@
</el-table-column>
<el-table-column label="会员" prop="isVip">
<template v-slot="scope">
<el-tag type="warning" v-if="scope.row.isVip"
>会员等级{{ scope.row.isVip }}</el-tag
>
<el-tag type="warning" v-if="scope.row.isVip">会员等级{{ scope.row.isVip }}</el-tag>
<span v-else></span>
</template>
</el-table-column>
<el-table-column label="余额" prop="amount"></el-table-column>
<el-table-column label="充值金额" prop="inMoney"></el-table-column>
<el-table-column label="订单数量" prop="orderNumber"></el-table-column>
<el-table-column label="积分" prop="totalScore"></el-table-column>
<el-table-column
label="手机号"
prop="telephone"
width="160"
></el-table-column>
<el-table-column
label="生日"
prop="birthDay"
width="200"
></el-table-column>
<el-table-column label="手机号" prop="telephone" width="160"></el-table-column>
<el-table-column label="生日" prop="birthDay" width="200"></el-table-column>
<el-table-column label="注册时间" prop="createAt" width="200">
<template v-slot="scope">
{{ scope.row.createAt | timeFilter }}
@ -104,26 +88,24 @@
{{ scope.row.lastLoginAt | timeFilter }}
</template>
</el-table-column>
<!-- <el-table-column label="操作" width="90" fixed="right">
<template v-slot="scope">
<el-button type="text" @click="$refs.addActive.show(scope.row)">编辑</el-button>
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
<!-- <el-table-column label="操作" width="200"> -->
<!-- <template v-slot="scope">
<el-button type="text" @click="">历史订单</el-button>
<el-button type="text" @click="">充值记录</el-button>
<el-button type="text" @click="">余额</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-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"
@size-change="sizeChange"
@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"
@size-change="sizeChange" @current-change="paginationChange"
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
</div>
</div>
</template>

View File

@ -40,6 +40,13 @@ module.exports = {
pathRewrite: {
'^/auth': 'auth'
}
},
'/source': {
target: process.env.VUE_APP_PHP_API,
changeOrigin: true,
pathRewrite: {
'^/source': 'source'
}
}
}
},