Commit d9263984 by 李伟康

refactor(dailyNewspaper): 优化日报功能逻辑和数据处理

- 在interceptionMixin中添加isNewReport字段支持新旧日报页面跳转
- 根据isNewReport条件动态调整页面导航逻辑到新的日报组件
- 移除dailyNewspaper页面中的调试console.log输出
- 重置dailyReportRecordId确保数据状态正确初始化
- 调整carBrandList获取逻辑的位置以提高代码可读性
- 将数值比较从!=改为!==以提升代码严谨性
1 parent 2ac400b0
...@@ -197,7 +197,7 @@ export default { ...@@ -197,7 +197,7 @@ export default {
}, },
/**延保日报 */ /**延保日报 */
equityStaffDailyReport() { equityStaffDailyReport() {
let { userInfo } = this let { userInfo, isNewReport } = this
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.$api.interceptionApi uni.$api.interceptionApi
.staffDailyReportMerchantValid({ .staffDailyReportMerchantValid({
...@@ -223,12 +223,23 @@ export default { ...@@ -223,12 +223,23 @@ export default {
if (res.confirm) { if (res.confirm) {
const pages = getCurrentPages(), const pages = getCurrentPages(),
currentPage = pages[pages.length - 1] currentPage = pages[pages.length - 1]
if (currentPage.route == 'pages/equity/tool/index') uni.$emit('jumpToDailyReport', formattedDate) if (currentPage.route == 'pages/equity/tool/index') {
if (isNewReport)
uni.redirectTo({
url: `/pages/common/dailyNewspaper/index?componentName=StaffDailyReport&currentDate=${formattedDate}`
})
else uni.$emit('jumpToDailyReport', formattedDate)
} else {
if (isNewReport)
uni.navigateTo({
url: `/pages/common/dailyNewspaper/index?componentName=StaffDailyReport&currentDate=${formattedDate}`
})
else else
uni.navigateTo({ uni.navigateTo({
url: `/pages/equity/tool/index?componentName=DailyReport&currentDate=${formattedDate}` url: `/pages/equity/tool/index?componentName=DailyReport&currentDate=${formattedDate}`
}) })
} }
}
}) })
resolve(true) resolve(true)
} else { } else {
......
...@@ -104,7 +104,7 @@ export default { ...@@ -104,7 +104,7 @@ export default {
}, },
ReportStatus: { ReportStatus: {
handler(val) { handler(val) {
this.saveBtn = val != 0 this.saveBtn = val !== 0
}, },
immediate: true, immediate: true,
deep: true deep: true
......
...@@ -173,7 +173,6 @@ export default { ...@@ -173,7 +173,6 @@ export default {
}, },
async back() { async back() {
const openNotice = await this.checkReport() const openNotice = await this.checkReport()
console.log(openNotice)
if (openNotice) this.exitInterception() if (openNotice) this.exitInterception()
else this.backPage() else this.backPage()
}, },
...@@ -284,7 +283,6 @@ export default { ...@@ -284,7 +283,6 @@ export default {
async changeDate(e) { async changeDate(e) {
if (e.fullDate == this.currentDate) return if (e.fullDate == this.currentDate) return
const openNotice = await this.checkReport() const openNotice = await this.checkReport()
console.log(openNotice)
if (!openNotice) { if (!openNotice) {
this.$refs.calendar.manualChangeDate(e) this.$refs.calendar.manualChangeDate(e)
this.changeCurrentDate(e) this.changeCurrentDate(e)
...@@ -323,6 +321,7 @@ export default { ...@@ -323,6 +321,7 @@ export default {
}, },
async getReportDetail() { async getReportDetail() {
this.reportStatus = '' this.reportStatus = ''
this.dailyReportRecordId = ''
uni.showLoading({ title: '加载中...', mask: true }) uni.showLoading({ title: '加载中...', mask: true })
try { try {
const { uuid, shopMerchantId } = this.userInfo, const { uuid, shopMerchantId } = this.userInfo,
......
...@@ -123,13 +123,6 @@ export default { ...@@ -123,13 +123,6 @@ export default {
}, },
async submitReport(res) { async submitReport(res) {
try { try {
const { shopMerchantId } = this.userInfo,
{ sceneType } = this,
carBrandList = await uni.$api.boutiqueApi.getDailyReportCarBrand({
merchantId: shopMerchantId,
sceneType
})
console.log(carBrandList)
const phoneRegex = /^1[3456789]\d{9}$/ const phoneRegex = /^1[3456789]\d{9}$/
uni.showLoading({ title: '提交中...', mask: true }) uni.showLoading({ title: '提交中...', mask: true })
let { reportParams } = this, let { reportParams } = this,
...@@ -185,6 +178,12 @@ export default { ...@@ -185,6 +178,12 @@ export default {
if (e.type == 'subform') delete e.children if (e.type == 'subform') delete e.children
}) })
const { shopMerchantId } = this.userInfo,
{ sceneType } = this,
carBrandList = await uni.$api.boutiqueApi.getDailyReportCarBrand({
merchantId: shopMerchantId,
sceneType
}) || []
requestJson.carBrandList = carBrandList.map(({ firstBrandId, firstBrandName, brandId, brandName }) => ({ requestJson.carBrandList = carBrandList.map(({ firstBrandId, firstBrandName, brandId, brandName }) => ({
firstBrandId, firstBrandId,
firstBrandName, firstBrandName,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!