Commit d9263984 by 李伟康

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

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