diff --git a/api/app/service/dingdan.js b/api/app/service/dingdan.js index 03e1ee8..997b7a7 100644 --- a/api/app/service/dingdan.js +++ b/api/app/service/dingdan.js @@ -7,7 +7,7 @@ class DingdanService extends Service { let { ctx } = this let modelLocal = ctx.model.Dingdan let chanpinModel = ctx.model.Chanpin - let returnData = { hasError: false, msg: "数据错误", list: [] } + let returnData = { hasError: false, msg: "数据错误", list: [], allxiaoshoujine: 0 } //新增 let subType = params.subType let returnComponent = params.returnData || [] @@ -50,6 +50,23 @@ class DingdanService extends Service { let paramsLocalInfo = _.omit(paramsLocal, ["pageSize", "currentPage", "url"]) let paramsLocalInfoNotDel = { ...paramsLocalInfo, isExit: 1 } let res = await modelLocal.find(paramsLocalInfoNotDel).sort({ update_at: -1 }).skip((currentPage - 1) * pageSize).limit(pageSize) + let whereOther = paramsLocalInfoNotDel["$where"] + let paramsLocalInfoAgg = _.omit(paramsLocalInfoNotDel, ["$where"]) + if (whereOther === "this.zuigaocaigoujia > this.xiaoshoujine") { + paramsLocalInfoAgg["$expr"] = { + "$gt": ["$zuigaocaigoujia", "$xiaoshoujine"] + } + } else if (whereOther === "this.pinmingxuanxiang.length>1") { + paramsLocalInfoAgg["$expr"] = { + "$gt": [{ "$size": "$pinmingxuanxiang" }, 1] + } + } + let allxiaoshoujine = await modelLocal.aggregate([{ + $match: paramsLocalInfoAgg, + }, + { + $group: { _id: null, totalSaleAmount: { $sum: '$xiaoshoujine' } } + }]) let resData = []; for (let i = 0; i < res.length; i++) { let elei = res[i]; @@ -66,6 +83,7 @@ class DingdanService extends Service { } returnData.hasError = false returnData.msg = "查询成功" + returnData.allxiaoshoujine = Number(Number((_.get(allxiaoshoujine, [0, "totalSaleAmount"], 0)) || 0).toFixed(2)) returnData.list = resData } let allParamsLocalInfo = _.omit(paramsLocal, ["pageSize", "currentPage", "url"]) diff --git a/front/electron-builder.yml b/front/electron-builder.yml index 6e218a0..2bd8a89 100644 --- a/front/electron-builder.yml +++ b/front/electron-builder.yml @@ -1,5 +1,5 @@ appId: com.electron.lichong -productName: 时光机 +productName: 产品处理 directories: buildResources: build files: diff --git a/front/src/renderer/src/App.vue b/front/src/renderer/src/App.vue index e9ea2c7..3883093 100644 --- a/front/src/renderer/src/App.vue +++ b/front/src/renderer/src/App.vue @@ -44,7 +44,7 @@ export default { }, }, async mounted() { - let fiveDay = dayjs('2024-06-29T00:00:00').valueOf() + let fiveDay = dayjs('2024-06-30T00:00:00').valueOf() if (!this.isVip) { if (dayjs().valueOf() > fiveDay) { this.isVip = false diff --git a/front/src/renderer/src/components/dingdantablecomponent.vue b/front/src/renderer/src/components/dingdantablecomponent.vue index b8b6fae..8a134c6 100644 --- a/front/src/renderer/src/components/dingdantablecomponent.vue +++ b/front/src/renderer/src/components/dingdantablecomponent.vue @@ -44,11 +44,17 @@ + +
+
+ 销售金额:{{ allxiaoshoujine }} +
+