diff --git a/api/app/model/chanpin.js b/api/app/model/chanpin.js index b69f5c4..a0f09db 100644 --- a/api/app/model/chanpin.js +++ b/api/app/model/chanpin.js @@ -51,7 +51,8 @@ module.exports = app => { // 箱装量 xiangzhuangliang: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 箱装单位 xiangzhuangdanwei: { @@ -61,7 +62,8 @@ module.exports = app => { // 最大单位箱装量 zuidadanweixiangzhuangliang: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 最大箱装单位 zuidaxiangzhuangdanwei: { @@ -91,82 +93,98 @@ module.exports = app => { // 最高采购价 zuigaocaigoujia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 商超价1 shangchaojia1: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 现金价 xianjinjia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 二批流通价 erpiliutongjia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 商超价 shangchaojia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 现金零售价 xianjinlingshoujia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 商超零售价 shangchaolingshoujia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 特通价 tetongjia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 分公司价 fengongsijia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 零食店价 shangchaolingshoujia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 初中高中价 chuzhonggaozhongjia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 车销价 chexiaojia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 发货价11 shangchaolingshoujia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 发货价12 fahuojia12: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 进货税率% jinhuoshuilv: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 发货税率% fahuoshuilv: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 包装 baozhuang: { @@ -176,7 +194,8 @@ module.exports = app => { // 毛利率 maolilv: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 主存放仓库 zhucunfangcangku: { @@ -191,7 +210,8 @@ module.exports = app => { // 保质期(天) baozhiqi: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 有效? youxiao: { @@ -216,7 +236,8 @@ module.exports = app => { // 单位重量 danweizhongliang: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(4)) } }, // 品牌 pinpai: { @@ -226,27 +247,32 @@ module.exports = app => { // 单位体积(立方米) danweitiji: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(4)) } }, // 箱重量(kg) xiangzhongliang: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(4)) } }, // 最大单位重量(kg) zuidadanweizhongliang: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(4)) } }, // 箱体积(立方米) xiangtiji: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(4)) } }, // 最大单位体积(立方米) zuidadanweitiji: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(4)) } }, // 描述 miaoshu: { @@ -271,22 +297,26 @@ module.exports = app => { // 标准核算价 biaozhunhesuanjia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 建议零售价 jianyilingshoujia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 最近一次采购价 zuijinyicicaigoujia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 最近一次销售价 zuijinyicixiaoshoujia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 箱条形码 xiangtiaoxingma: { @@ -318,22 +348,26 @@ module.exports = app => { // 发货产品基数 fahuochanpinjishu: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 采购最少数量 caigouzuishaoshuliang: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 采购倍数 caigoubeishu: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 采购滚动基数 caigougundongjishu: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 最小单位产品 zuixiaodanweichanpin: { @@ -343,7 +377,8 @@ module.exports = app => { // 最小单位倍数 zuixiaodanweibeishu: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 产品归类 chanpinguilei: { @@ -358,142 +393,170 @@ module.exports = app => { // 箱单位最高采购价 xiangdanweizuigaocaigoujia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 箱单位商超价1 xiangdanweishangchaojia1: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 箱单位现金价 xiangdanweixianjinjia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 箱单位二批流通价 xiangdanweierpiliutongjia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 箱单位商超价 xiangdanweishangchaojia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 箱单位现金零售价 xiangdanweixianjinlingshoujia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 箱单位商超零售价 xiangdanweishangchaolingshoujia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 箱单位特通价 xiangdanweitetongjia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 箱单位分公司价 xiangdanweifengongsijia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 箱单位零食店价 xiangdanweilingshidianjia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 箱单位初中高中价 xiangdanweichuzhonggaozhongjia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 箱单位车销价 xiangdanweichexiaojia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 箱单位发货价11 xiangdanweifahuojia11: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 箱单位发货价12 xiangdanweifahuojia12: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 最大单位最高采购价 zuidadanweizuigaocaigoujia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 最大单位商超价1 zuidadanweishangchaojia1: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 最大单位现金价 zuidadanweixianjinjia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 最大单位二批流通价 zuidadanweierpiliutongjia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 最大单位商超价 zuidadanweishangchaojia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 最大单位现金零售价 zuidadanweixianjinlingshoujia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 最大单位商超零售价 zuidadanweishangchaolingshoujia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 最大单位特通价 zuidadanweitetongjia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 最大单位分公司价 zuidadanweifengongsijia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 最大单位零食店价 zuidadanweilingshidianjia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 最大单位初中高中价 zuidadanweichuzhonggaozhongjia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 最大单位车销价 zuidadanweichexiaojia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 最大单位发货价11 zuidadanweifahuojia11: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 最大单位发货价12 zuidadanweifahuojia12: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 默认单据单位 morendanjudanwei: { @@ -523,7 +586,7 @@ module.exports = app => { // 建档日期 jiandangriqi: { type: Date, - default: Date.now + default: "" }, // 出货是否加工 chuhuoshifujiagong: { @@ -533,27 +596,31 @@ module.exports = app => { // 保质期天数需大于 baozhiqitianshuxudayu: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 单品重量误差 danpinzhongliangwucha: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 最大单品重量误差百分比% zuidadanpinzhongliangwuchabaifenbi: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 最大箱重量误差 zuidaxiangzhongliangwucha: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 价格调整时间 jiagediaozhengshijian: { type: Date, - default: Date.now + default: "" }, // 录入人 lururen: { @@ -563,7 +630,8 @@ module.exports = app => { // 允收天数 yunshoutianshu: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 强制序列号管理 qiangzhixuliehaoguanli: { @@ -578,22 +646,26 @@ module.exports = app => { // 长(cm) chang: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(4)) } }, // 宽(cm) kuan: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(4)) } }, // 高(cm) gao: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(4)) } }, // 每托盘件数 meituopanjianshu: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, //数据是否删除 isExit: { diff --git a/api/app/model/dingdan.js b/api/app/model/dingdan.js index 4a32b68..1281ce2 100644 --- a/api/app/model/dingdan.js +++ b/api/app/model/dingdan.js @@ -48,7 +48,8 @@ module.exports = app => { // 单据单位数量 danjudanweishuliang: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 条码 tiaoma: { @@ -63,22 +64,26 @@ module.exports = app => { // 修改后销售数量 xiugaihouxiaoshoushuliang: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 最高采购价 zuigaocaigoujia: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 箱装量 xiangzhuangliang: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 最大箱装量 zuidaxiangzhuangliang: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 规格型号 guigexinghao: { @@ -128,14 +133,16 @@ module.exports = app => { // 销售数量 xiaoshoushuliang: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, // 销售金额 xiaoshoujine: { type: Number, - default: 0 + default: 0, + set: (val) => { return Number(Number(val).toFixed(2)) } }, - //是否售卖 + //是否无售卖 isNotSale: { type: Boolean, default: true, diff --git a/api/app/model/user.js b/api/app/model/user.js index 6bb2938..1c4699b 100644 --- a/api/app/model/user.js +++ b/api/app/model/user.js @@ -19,8 +19,8 @@ module.exports = app => { }, // 客户编号 usercode: { - type: Number, - default: 0, + type: String, + default: "", index: true, unique: true }, diff --git a/api/app/service/dingdan.js b/api/app/service/dingdan.js index b88cd04..03e1ee8 100644 --- a/api/app/service/dingdan.js +++ b/api/app/service/dingdan.js @@ -29,14 +29,15 @@ class DingdanService extends Service { returnData.hasError = false returnData.msg = "数据删除成功" } else if (subType === "edit") { - paramsLocal = paramsLocal.list[0] - paramsLocal["update_at"] = Date.now(); - let chanpinItemA = await chanpinModel.find({ tiaoxingma: paramsLocal.tiaoma }) - let chanpinItemB = await chanpinModel.find({ xiangtiaoxingma: paramsLocal.tiaoma }) - let chanpinItemC = await chanpinModel.find({ zuidaxiangzhuangtiaoma: paramsLocal.tiaoma }) + let list = await this.dealList(paramsLocal.list) + let updateItem = list[0] + updateItem["update_at"] = Date.now(); + let chanpinItemA = await chanpinModel.find({ tiaoxingma: updateItem.tiaoma }) + let chanpinItemB = await chanpinModel.find({ xiangtiaoxingma: updateItem.tiaoma }) + let chanpinItemC = await chanpinModel.find({ zuidaxiangzhuangtiaoma: updateItem.tiaoma }) if (chanpinItemA.length || chanpinItemB.length || chanpinItemC.length) { - paramsLocal = { ...paramsLocal, isNotSale: false } - let res = await modelLocal.updateOne({ _id: paramsLocal._id }, paramsLocal) + updateItem = { ...updateItem, isNotSale: false } + let res = await modelLocal.updateOne({ _id: updateItem._id }, updateItem) returnData.hasError = false returnData.msg = "数据更新成功" } else { @@ -76,7 +77,9 @@ class DingdanService extends Service { async dealList(list) { let { ctx } = this let listLocal = [] - let listCopy = _.cloneDeep(list) + let modelLocal = ctx.model.Dingdan + let allList = await modelLocal.find({ isExit: 1 }) + let listCopy = _.concat(list, allList) let pinmingGroup = _.groupBy(listCopy, o => o.tiaoma) let pinmingOptionObj = {} for (let key in pinmingGroup) { @@ -89,7 +92,7 @@ class DingdanService extends Service { pinmingOptionItem["value"] = element.pinming pinmingxuxnaing.push(pinmingOptionItem) } - pinmingOptionObj[key] = pinmingxuxnaing + pinmingOptionObj[key] = _.unionBy(pinmingxuxnaing, "value") } let userModel = ctx.model.User let chanpinModel = ctx.model.Chanpin @@ -125,7 +128,7 @@ class DingdanService extends Service { item["xiugaihouxiaoshoushuliang"] = item.xiaoshoushuliang } item["xiaoshoujine"] = item.xiaoshoujine - item["zuigaocaigoujia"] = _.get(chanpinItemA, [0, "zuigaocaigoujia"], "") + item["zuigaocaigoujia"] = _.get(chanpinItemA, [0, "zuigaocaigoujia"], 0) item["xiangzhuangliang"] = _.get(chanpinItemA, [0, "xiangzhuangliang"], "") item["zuidaxiangzhuangliang"] = _.get(chanpinItemA, [0, "zuidadanweixiangzhuangliang"], "") item["guigexinghao"] = _.get(chanpinItemA, [0, "guigexinghao"], "") @@ -142,7 +145,7 @@ class DingdanService extends Service { let jishu = Number(guigexinghaoArr[1]) item["xiugaihouxiaoshoushuliang"] = item.xiaoshoushuliang * jishu item["xiaoshoujine"] = item.xiaoshoujine - item["zuigaocaigoujia"] = _.get(chanpinItemB, [0, "zuigaocaigoujia"], "") + item["zuigaocaigoujia"] = _.get(chanpinItemB, [0, "zuigaocaigoujia"], 0) item["xiangzhuangliang"] = _.get(chanpinItemB, [0, "xiangzhuangliang"], "") item["zuidaxiangzhuangliang"] = _.get(chanpinItemB, [0, "zuidadanweixiangzhuangliang"], "") item["guigexinghao"] = _.get(chanpinItemB, [0, "guigexinghao"], "") @@ -159,7 +162,7 @@ class DingdanService extends Service { let jishu = Number(guigexinghaoArr[1]) item["xiugaihouxiaoshoushuliang"] = item.xiaoshoushuliang * jishu * Number((_.get(chanpinItemC, [0, "xiangzhuangliang"], 1) || 1)) item["xiaoshoujine"] = item.xiaoshoujine - item["zuigaocaigoujia"] = _.get(chanpinItemC, [0, "zuigaocaigoujia"], "") + item["zuigaocaigoujia"] = _.get(chanpinItemC, [0, "zuigaocaigoujia"], 0) item["xiangzhuangliang"] = _.get(chanpinItemC, [0, "xiangzhuangliang"], "") item["zuidaxiangzhuangliang"] = _.get(chanpinItemC, [0, "zuidadanweixiangzhuangliang"], "") item["guigexinghao"] = _.get(chanpinItemC, [0, "guigexinghao"], "") @@ -173,7 +176,7 @@ class DingdanService extends Service { item["xiaoshoushuliang"] = item.xiaoshoushuliang item["xiugaihouxiaoshoushuliang"] = item.xiaoshoushuliang item["xiaoshoujine"] = item.xiaoshoujine - item["zuigaocaigoujia"] = "" + item["zuigaocaigoujia"] = 0 item["xiangzhuangliang"] = "" item["zuidaxiangzhuangliang"] = "" item["guigexinghao"] = "" diff --git a/api/package.json b/api/package.json index 0a6bfad..d47caf1 100644 --- a/api/package.json +++ b/api/package.json @@ -25,11 +25,7 @@ "start": "egg-scripts start --daemon --title=egg-server-back", "stop": "egg-scripts stop --title=egg-server-back", "dev": "egg-bin dev", - "test": "npm run lint -- --fix && npm run test:local", - "test:local": "egg-bin test", - "cov": "egg-bin cov", - "lint": "eslint .", - "ci": "npm run lint && npm run cov" + "build": "npm install --production && tar -zcvf ../release.tgz ." }, "repository": { "type": "git", @@ -37,4 +33,4 @@ }, "author": "lichong", "license": "MIT" -} +} \ No newline at end of file diff --git a/front/src/main/index.js b/front/src/main/index.js index 327d842..2125b18 100644 --- a/front/src/main/index.js +++ b/front/src/main/index.js @@ -10,8 +10,8 @@ function createWindow() { mainWindow = new BrowserWindow({ // fullscreen: true, // fullscreenable: true, - width: 960, - height: 540, + width: 1280, + height: 800, // width:1080, // height:1920, show: false, diff --git a/front/src/renderer/src/assets/css/base.css b/front/src/renderer/src/assets/css/base.css index a4fe4a3..bd4dce1 100644 --- a/front/src/renderer/src/assets/css/base.css +++ b/front/src/renderer/src/assets/css/base.css @@ -8,13 +8,18 @@ body { padding: 0 !important; } -.el-table .isNotSale { +.el-table .blueRow { background-color: #a0cfff; } .el-table .redRow { background-color: #fab6b6; } + .el-table .yellowRow { background-color: #f3d19e; +} + +.el-table .lightYellowRow { + background-color: #faecd8; } \ No newline at end of file diff --git a/front/src/renderer/src/components/dingdanformcomponent.vue b/front/src/renderer/src/components/dingdanformcomponent.vue index d003d6c..8a8e3dd 100644 --- a/front/src/renderer/src/components/dingdanformcomponent.vue +++ b/front/src/renderer/src/components/dingdanformcomponent.vue @@ -27,7 +27,6 @@ diff --git a/front/src/renderer/src/components/dingdantablecomponent.vue b/front/src/renderer/src/components/dingdantablecomponent.vue index 5fb3f70..b8b6fae 100644 --- a/front/src/renderer/src/components/dingdantablecomponent.vue +++ b/front/src/renderer/src/components/dingdantablecomponent.vue @@ -5,6 +5,9 @@ + @@ -109,17 +112,20 @@ export default { }, // 设置行属性 getRowClassName({ row }) { + let rowClassName = "" if (row.isNotSale) { - return 'isNotSale' + rowClassName = "blueRow" } if (row.xiaoshoujine < row.zuigaocaigoujia) { - return 'redRow' + rowClassName = "redRow" } if ((row.pinmingxuanxiang || []).length > 1) { - return 'yellowRow' + rowClassName = "yellowRow" } - return '' - + if (dayjs(row.update_at.slice(0, 19)).valueOf() > dayjs(row.create_at.slice(0, 19)).valueOf()) { + rowClassName = "lightYellowRow" + } + return rowClassName }, }, diff --git a/front/src/renderer/src/components/formcomponent.vue b/front/src/renderer/src/components/formcomponent.vue index 5434c4e..9705095 100644 --- a/front/src/renderer/src/components/formcomponent.vue +++ b/front/src/renderer/src/components/formcomponent.vue @@ -21,7 +21,6 @@ diff --git a/front/src/renderer/src/components/tablecomponent.vue b/front/src/renderer/src/components/tablecomponent.vue index 76aa203..7714cab 100644 --- a/front/src/renderer/src/components/tablecomponent.vue +++ b/front/src/renderer/src/components/tablecomponent.vue @@ -1,12 +1,16 @@