Commit 54de47d6 by 李伟康

refactor(dailyNewspaper): 重构日报页面计算属性和方法结构

- 将 isToday 和 reportParams 移动到 computed 部分
- 优化 reportParams 中的参数构建逻辑
- 调整代码组织结构提升可读性
- 保持原有的业务逻辑不变
1 parent 41d409f0
...@@ -19,6 +19,27 @@ export default { ...@@ -19,6 +19,27 @@ export default {
ReportStatus: null ReportStatus: null
}, },
computed: { computed: {
isToday() {
return this.currentDate == this.nowDate
},
reportParams() {
let { shopMerchantId, shopMerchantName, uuid, name } = this.userInfo,
{ currentDate, templateType, dailyReportRecordId } = this,
params = {
merchantId: shopMerchantId,
merchantName: shopMerchantName,
reportDate: currentDate,
staffUuid: uuid,
staffName: name,
dailyReportSource: 2, //1:生意助手员工版小程序,2:平板电脑
templateType: templateType()
}
if (dailyReportRecordId()) params.dailyReportRecordId = dailyReportRecordId()
return params
}
},
watch: {},
methods: {
itemShow(item, parent, data) { itemShow(item, parent, data) {
try { try {
let childrenShowRules = parent.childrenShowRules || null let childrenShowRules = parent.childrenShowRules || null
...@@ -45,27 +66,6 @@ export default { ...@@ -45,27 +66,6 @@ export default {
console.log(error) console.log(error)
} }
}, },
isToday() {
return this.currentDate == this.nowDate
},
reportParams() {
let { shopMerchantId, shopMerchantName, uuid, name } = this.userInfo,
{ currentDate, templateType, dailyReportRecordId } = this,
params = {
merchantId: shopMerchantId,
merchantName: shopMerchantName,
reportDate: currentDate,
staffUuid: uuid,
staffName: name,
dailyReportSource: 2, //1:生意助手员工版小程序,2:平板电脑
templateType: templateType()
}
if (dailyReportRecordId()) params.dailyReportRecordId = dailyReportRecordId()
return params
}
},
watch: {},
methods: {
async saveReport(res) { async saveReport(res) {
try { try {
uni.showLoading({ title: '提交中...', mask: true }) uni.showLoading({ title: '提交中...', mask: true })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!