lichong 9 months ago
parent
commit
b63b7de876
  1. 20
      api/app/service/dingdan.js
  2. 2
      front/electron-builder.yml
  3. 2
      front/src/renderer/src/App.vue
  4. 22
      front/src/renderer/src/components/dingdantablecomponent.vue
  5. 1
      front/src/renderer/src/components/tablecomponent.vue
  6. 12
      front/src/renderer/src/views/dingdan.vue
  7. BIN
      模版/销售订单导入准备表.xlsx

20
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"])

2
front/electron-builder.yml

@ -1,5 +1,5 @@
appId: com.electron.lichong
productName: 时光机
productName: 产品处理
directories:
buildResources: build
files:

2
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

22
front/src/renderer/src/components/dingdantablecomponent.vue

@ -44,11 +44,17 @@
</template>
</el-table-column>
</el-table>
</div>
<div class="inline-block">
<el-pagination style="margin:8px 0 0 0" v-model:current-page="currentPage" v-model:page-size="pageSize"
:total="total" @size-change="handleSizeChange" layout="total, sizes, prev, pager, next, jumper"
:page-sizes="pageSizes" @current-change="handleCurrentChange" @prev-click="handleCurrentChange"
@next-click="handleCurrentChange"></el-pagination>
</div>
<div class="inline-block xiaoshoujine">
<span>销售金额</span><span style="color:red;margin: 0 4px 0 0px">{{ allxiaoshoujine }}</span><span></span>
</div>
</template>
<script>
@ -58,6 +64,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
export default {
name: 'dingdantablecomponent',
components: {},
emits: ["selectChange", "handleCurrentChange", "handleSizeChange", "edit", "info", "del"],
props: {
tableHeader: {
type: Array,
@ -83,6 +90,12 @@ export default {
return 0
}
},
allxiaoshoujine: {
type: Number,
default: () => {
return 0
}
},
},
data() {
@ -139,4 +152,13 @@ export default {
text-align: center;
text-align-last: center;
}
.inline-block {
display: inline-block;
text-align: left;
}
.xiaoshoujine {
margin-left: 24px
}
</style>

1
front/src/renderer/src/components/tablecomponent.vue

@ -58,6 +58,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
export default {
name: 'tablecomponent',
components: {},
emits: ["selectChange", "handleCurrentChange", "handleSizeChange", "edit", "info", "del"],
props: {
tableHeader: {
type: Array,

12
front/src/renderer/src/views/dingdan.vue

@ -67,7 +67,7 @@
<div>
<dingdantablecomponent :tableHeader="tableHeader" :tableData="tableData" :pageSizes="pageSizes" :total="total"
@selectChange="selectChange" @handleCurrentChange="handleCurrentChange" @handleSizeChange="handleSizeChange"
@edit="edit" @info="info" @del="del">
@edit="edit" @info="info" @del="del" :allxiaoshoujine="allxiaoshoujine">
</dingdantablecomponent>
</div>
<el-dialog v-model="dialogFrom.visible" :title="dialogFrom.title" width="80%">
@ -119,6 +119,7 @@ export default {
fileOriData: [],
exportxiaoshou: [],
exportS6: [],
allxiaoshoujine: 0,
}
},
methods: {
@ -175,7 +176,7 @@ export default {
let ele = _.find(list, o => o.kehumingcheng)
for (let i = 0; i < list.length; i++) {
let element = list[i];
element['kehumingcheng'] = ele.kehumingcheng
element['kehumingcheng'] = _.get(ele, ["kehumingcheng"], "")
element['kehubianhao'] = value
}
let params = {
@ -192,7 +193,7 @@ export default {
that.updateSeach({ subType: "get" })
}, 1500);
})
.catch(() => {
.catch((err) => {
ElMessage({
type: 'danger',
message: '导入失败',
@ -229,6 +230,7 @@ export default {
that.tableData = [str.list]
}
that.total = str.count
that.allxiaoshoujine = str.allxiaoshoujine
}
})
},
@ -441,7 +443,7 @@ export default {
}
lilstLocal.push(listItem)
}
lilstLocal.push({ "销售金额": `总计:${allMoney}` })
// lilstLocal.push({ "": `${allMoney}` })
let jsonWorkSheet = this.$XLSX.utils.json_to_sheet(lilstLocal);
let workBook = {
SheetNames: ["sheet1"],
@ -493,7 +495,7 @@ export default {
}
lilstLocal.push({ ...allObj, ...listItem })
}
lilstLocal.push({ "单据单位数量": `总计:${allMoney}` })
// lilstLocal.push({ "": `${allMoney}` })
let jsonWorkSheet = this.$XLSX.utils.json_to_sheet(lilstLocal);
let workBook = {
SheetNames: ["sheet1"],

BIN
模版/销售订单导入准备表.xlsx

Binary file not shown.
Loading…
Cancel
Save