Commit 774abdcb by 胡悦

feat: 添加工资申诉入口及优化权限文案

- 在 common.js 中添加获取工资申诉入口的 API 方法
- 在 Entrance 组件中动态控制工资申诉入口的显示,根据接口权限和用户场景过滤
- 优化 Android 权限申请提示文案,使其更通用
- 修复工资申诉页面中变量名错误(currentCount -> count)和条件判断错误(type -> popType)
- 调整工资申诉页面扣款金额的显示格式,避免重复负号
1 parent 74bd583f
......@@ -602,4 +602,12 @@ module.exports = {
...data,
})
},
// 工资申诉入口判断
getWageAppealEntrance(data={}) {
return http.post({
method: 'dj.staff.api.has.performance.config.formerchant',
projectName: 'staffMiniprogram',
...data,
})
},
}
......@@ -30,11 +30,20 @@ export default {
}
},
data() {
return {}
return {
// 工资申诉入口是否允许显示
wageAppealAllowed: false,
// 工资申诉入口加载中,加载完成前不展示避免误显示
loadingEntrance: true
}
},
created() {
// 组件创建时请求工资申诉入口权限
this.fetchWageAppealEntrance()
},
computed: {
entranceList() {
let { sceneType } = uni.$storage.get('userInfo'),
let { sceneType } = uni.$storage.get('userInfo') || {},
entranceList = [
{
icon: 'daily-report',
......@@ -93,10 +102,45 @@ export default {
sceneType: [7]
}
]
return entranceList.filter(e => e.sceneType.includes(sceneType))
// 先根据场景过滤
let list = entranceList.filter(e => e.sceneType.includes(sceneType))
// 加载阶段或不允许显示时,移除工资申诉入口
if (this.loadingEntrance || !this.wageAppealAllowed) {
list = list.filter(e => e.name !== 'WageAppeal')
}
return list
}
},
methods: {
// 请求工资申诉入口权限,并设置显示开关
async fetchWageAppealEntrance() {
try {
this.loadingEntrance = true
const userInfo = uni.$storage.get('userInfo') || {}
const { shopMerchantId } = userInfo
// 缺少商户ID时降级为不展示
if (!shopMerchantId) {
this.wageAppealAllowed = false
return
}
const res = await uni.$api.commonApi.getWageAppealEntrance({
merchantId: shopMerchantId
})
// 兼容不同返回结构,解析是否允许显示
this.wageAppealAllowed = !!res
} catch (error) {
// 接口异常降级:不展示工资申诉入口,并提示(非打断式)
this.wageAppealAllowed = false
if (error) {
uni.showToast({
title: '工资申诉入口获取失败',
icon: 'none'
})
}
} finally {
this.loadingEntrance = false
}
},
handleClick(item) {
// 这里可以根据实际需求进行跳转或功能处理
this.$emit('entranceClick', item)
......
......@@ -164,11 +164,11 @@ function requestAndroidPermission (permissionID) {
},
['android.permission.CAMERA']: {
title: '相机',
content: '为了拍摄活动现场照片及客户购车凭证,展业助手需要申请您的相机权限。'
content: '展业助手需要申请相机权限,用于上传相关图片资料以完成业务办理。'
},
['android.permission.READ_EXTERNAL_STORAGE']: {
title: '相册',
content: '为了上传活动现场照片及客户购车凭证,展业助手需要申请您的相册权限。'
content: '展业助手需要申请相册权限,用于上传相关图片资料以完成业务办理。'
}
}[permissionID] || {
title: permissionID,
......
......@@ -159,10 +159,10 @@ export default {
methods: {
onInput: debounce(function(e) {
let value = e.detail.value
if (this.type === 'record') {
if (this.popType === 'record') {
// Integer only
value = value.replace(/[^\d]/g, '')
} else if (this.type === 'attendance') {
} else if (this.popType === 'attendance') {
// Decimal with 2 places
value = value.replace(/[^\d.]/g, '') // Remove non-digits/dots
.replace(/^\./g, '') // No starting dot
......@@ -270,9 +270,9 @@ export default {
})
},
async confirm() {
const { modifyCount, remark, images, otherAbnormalMessage, shopCount} = this.formData, {currentCount} = this
const { modifyCount, remark, images, otherAbnormalMessage, shopCount} = this.formData, {count} = this
// 校验申诉天数是否在上个月自然日天数内
if (this.type == 'attendance' && modifyCount && !this.checkLastNaturalDay(modifyCount)) return
if (this.popType == 'attendance' && modifyCount && !this.checkLastNaturalDay(modifyCount)) return
const { sceneType, shopMerchantId } = uni.$storage.get('userInfo')
const params = {
appealMonth: this.month,
......@@ -282,14 +282,14 @@ export default {
if (remark) params.remark = remark
if (images.length > 0) params.attachmentList = images
if (otherAbnormalMessage) params.otherAbnormalMessage = otherAbnormalMessage
if (this.type == 'record') {
if (this.popType == 'record') {
params.appealType = 2
params.padRecordNum = currentCount
params.padRecordNum = count
params.shopCount = shopCount
if (modifyCount) params.applyPadRecordNum = modifyCount
} else if (this.type == 'attendance') {
} else if (this.popType == 'attendance') {
params.appealType = 1
params.actualAttendanceDays = currentCount
params.actualAttendanceDays = count
if (modifyCount) params.applyActualAttendanceDays = modifyCount
}
console.log(params, 'params')
......
<template>
<view class="wage-appeal">
<view class="common-title">工资申诉{{ month }}</view>
<view class="common-title">工资申诉</view>
<scroll-view scroll-y class="section">
<!-- 考勤/日报/平板录音卡片区 -->
......@@ -26,7 +26,7 @@
</view>
</view>
<view class="card-desc">填写驻店日报天数</view>
<view class="deduction">扣款 <text class="amount">-{{ appealData.dailyReportDeductionAmount != null ? appealData.dailyReportDeductionAmount + '元' : '-' }}</text></view>
<view class="deduction">扣款 <text :class="{'amount': appealData.dailyReportDeductionAmount != null}">{{appealData.dailyReportDeductionAmount ? '-' : ''}}{{ appealData.dailyReportDeductionAmount != null ? appealData.dailyReportDeductionAmount + '元' : '-' }}</text></view>
<view class="missing-days" v-if="appealData.missingDailyReportDates && appealData.missingDailyReportDates.length">
<text class="warning-text">缺失天数为</text> <text class="warning-content"><text v-for="(day, idx) in appealData.missingDailyReportDates" :key="idx">{{ day }}{{ idx < appealData.missingDailyReportDates.length - 1 ? '、' : '' }}</text>号</text>
</view>
......@@ -42,7 +42,7 @@
</view>
</view>
<view class="card-desc">触客总数为 <text :class="{'blue-text': appealData.touchCustomerTotal != null}">{{ appealData.touchCustomerTotal != null ? appealData.touchCustomerTotal + '条' : '-' }}</text></view>
<view class="deduction">扣款 <text :class="{'amount': appealData.padDeductionAmount != null}">{{ appealData.padDeductionAmount != null ? '-' + appealData.padDeductionAmount + '元' : '-' }}</text></view>
<view class="deduction">扣款 <text :class="{'amount': appealData.padDeductionAmount != null}">{{ appealData.padDeductionAmount ? '-' : '' }}{{ appealData.padDeductionAmount != null ? appealData.padDeductionAmount + '元' : '-' }}</text></view>
<view v-if="appealData.padAppealable" class="action-btn" @click="handleAppeal('record')">申诉平板</view>
</view>
</view>
......@@ -132,9 +132,6 @@ export default {
}
}
},
mounted() {
this.loadData(this.lastMonth)
},
methods: {
// 格式化时间
formatTime(time, formatStr) {
......@@ -297,7 +294,6 @@ export default {
border-radius: toRpx(32);
color: #3B73FF;
font-size: toRpx(28);
font-weight: 500;
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!