Commit dddd68ce by wangzhihui

feat(accountApproval): Implement new account approval feature

- Added account approval API with methods for fetching details and processing approvals.
- Created a new Vue component for account approval interface, including status display and action buttons.
- Updated routing to include account approval page.
- Enhanced state management for authorization and URL parameter handling.
- Added mock data for testing purposes.
- Included a new image asset for empty state representation.
1 parent 65f453a3
...@@ -25,7 +25,9 @@ ...@@ -25,7 +25,9 @@
// "source.organizeImports": "explicit", // "source.organizeImports": "explicit",
"source.fixAll.eslint": "explicit" "source.fixAll.eslint": "explicit"
}, },
"[vue]": {}, "[vue]": {
"editor.defaultFormatter": "octref.vetur"
},
"[javascript]": {}, "[javascript]": {},
"[javascriptreact]": {}, "[javascriptreact]": {},
"i18n-ally.sourceLanguage": "zh-chs", "i18n-ally.sourceLanguage": "zh-chs",
......
const url = '/rop-dj-car-boutique/router'
export default {
/** 新员工开账号审核-详情 */
getAccountApplyDetail(data = {}) {
data.method = 'dj.api.smartcarlife.staffBaseInfo.account.approval.detail'
return window.$HTTP({
url,
data,
returnAll: true
})
},
/** 新员工开账号审核-审批处理 */
auditAccountApply(data = {}) {
data.method = 'dj.api.smartcarlife.staffAccountApproval.process'
return window.$HTTP({
url,
data,
returnAll: true
})
}
}
const url = '/rop-dj-smartcarlife/router' const url = '/rop-dj-car-boutique/router'
export default { export default {
/** 获取订单待审核详情 */ /** 获取订单待审核详情 */
...@@ -12,7 +12,16 @@ export default { ...@@ -12,7 +12,16 @@ export default {
}, },
/** 订单申请审核 */ /** 订单申请审核 */
auditOrderApply(data = {}) { auditOrderApply(data = {}) {
data.method = 'dj.api.smartcarlife.goodsOrderApplyRecord.audit.update' data.method = 'dj.api.smartcarlife.goodsOrderApplyRecord.h5.audit.update'
return window.$HTTP({
url,
data,
returnAll: true
})
},
// 根据手机号查询员工信息,入参:phone
getStaffInfoByPhone(data = {}) {
data.method = 'dj.api.smartcarlife.query.staffInfoByPhone'
return window.$HTTP({ return window.$HTTP({
url, url,
data, data,
......
...@@ -120,6 +120,18 @@ const pages = { ...@@ -120,6 +120,18 @@ const pages = {
showAction: true showAction: true
} }
} }
],
accountApproval:[
{
name: 'index',
meta: {
keepAlive: true,
title: '新员工开账号审批',
noAuth: true,
backgroundColor: '#f7f8fa',
showAction: true
}
}
] ]
} }
let routes = [ let routes = [
......
...@@ -21,6 +21,83 @@ const state = { ...@@ -21,6 +21,83 @@ const state = {
import router from '@/router' import router from '@/router'
const EVECTION_AUTH_PATHS = ['/department', '/personage', '/company']
const APPROVAL_AUTH_PATHS = ['/orderApproval', '/accountApproval']
function saveUrlParams() {
const { corpId, agentId, phone, name, id, orderCode, uuid } = util.getQuery()
if (phone) util.setLocalStorage('ww_params_phone', phone)
if (name) util.setLocalStorage('ww_params_name', name)
if (id) util.setLocalStorage('ww_params_id', id)
if (uuid) util.setLocalStorage('ww_params_uuid', uuid)
if (orderCode) util.setLocalStorage('ww_orderCode', orderCode)
if (corpId) {
const ww_storage_info = util.getLocalStorage('ww_storage_info') || {}
ww_storage_info.corpId = corpId
if (agentId && agentId != 'undefined') ww_storage_info.agentId = agentId
util.setLocalStorage('ww_storage_info', ww_storage_info)
}
}
function needWwAuth(href) {
const pushId = util.getQuery('pushId')
const isEvectionPath = EVECTION_AUTH_PATHS.some(keyword => href.includes(keyword))
const isApprovalPath = APPROVAL_AUTH_PATHS.some(keyword => href.includes(keyword))
if (isEvectionPath && pushId && pushId * 1 > 744) return true
if (isApprovalPath) return true
return false
}
async function handleWwLogin({ commit }) {
const { corpId, agentId } = util.getQuery()
const wwCode = util.getQuery('code')
const { loginUrl } = window.$fetchConfig
let userInfo = util.getLocalStorage('ww_userInfo') || ''
if (userInfo && userInfo.timestamp) {
if (Date.now() - userInfo.timestamp <= 1000 * 60 * 1440) {
commit('SET_AUTHORIZE_PAGE', true)
commit('SET_SHOW_WINDOW', true)
return
}
}
if (wwCode) {
const res = await ssoApi.login({ code: wwCode, corpId, getUserInfoFlag: false })
const { code, data, message } = res
if (code == '0') {
commit('SET_AUTHORIZE_PAGE', true)
commit('SET_SHOW_WINDOW', true)
const hrefUrl = window.location.href
const newUrl = hrefUrl.replace(/([?&])code=[^&]*/, (match, prefix) => (prefix === '?' ? '?' : ''))
window.history.replaceState({}, '', newUrl)
if (data.loginList && data.loginList.length) {
const [item] = data.loginList
if (item.loginList && item.loginList.length) {
const [loginUserInfo] = item.loginList
if (loginUserInfo.phone) util.setLocalStorage('ww_params_phone', loginUserInfo.phone)
loginUserInfo.timestamp = Date.now()
util.setLocalStorage('ww_userInfo', loginUserInfo)
return
}
}
throw new Error('登录失败或无权限')
}
Notify({ message })
commit('SET_SHOW_WINDOW', false)
commit('SET_AUTHORIZE_PAGE', false)
return
}
commit('SET_AUTHORIZE_PAGE', false)
const ua = navigator.userAgent.toLowerCase()
if (ua.match(/MicroMessenger/i) && ua.match(/wxwork/i)) {
window.location.href = `${loginUrl}?redirect_uri=${encodeURIComponent(window.location.href)}&corpId=${corpId}&agentId=${agentId}&backLoginCode=BACKCODE`
} else {
Notify({ message: '请使用企业微信打开', duration: 72000000 })
}
}
const mutations = { const mutations = {
SET_PAGE_META(state, meta) { SET_PAGE_META(state, meta) {
state.pageMeta = meta state.pageMeta = meta
...@@ -49,97 +126,24 @@ const actions = { ...@@ -49,97 +126,24 @@ const actions = {
// window.$HTTP = new Http({ ...window.$fetchConfig, alert: Notify, headers: { token: sessionId } }) // window.$HTTP = new Http({ ...window.$fetchConfig, alert: Notify, headers: { token: sessionId } })
}, },
login({ dispatch, commit, state }) { login({ commit }) {
//获取当前路由路径 // 缓存 corpId/agentId 等公共参数,再进入 OAuth
const currentPath = window.location.href; saveUrlParams()
const pathKeywords = ['/department', '/personage', '/company']; const currentPath = window.location.href
const isTargetPath = pathKeywords.some(keyword => currentPath.includes(keyword)); if (needWwAuth(currentPath)) {
// const pathTitleMap = { handleWwLogin({ commit }).catch(error => {
// '/department': '美团消费部门月度总结', const message = error && error.message ? error.message : '登录失败或无权限'
// '/personage': '美团消费个人月度总结', Notify(message)
// '/company': '美团消费公司月度总结' })
// };
// const matchedPath = Object.keys(pathTitleMap).find(path => currentPath.includes(path));
// if (matchedPath) {
// document.title = pathTitleMap[matchedPath];
// }
const pushId = util.getQuery('pushId');
if (isTargetPath && (pushId && (pushId * 1) > 744)) {
try {
let { corpId, agentId } = util.getQuery();
const wwCode = util.getQuery('code');
let { loginUrl } = window.$fetchConfig;
let userInfo = util.getLocalStorage('ww_userInfo') || '';
if (userInfo && userInfo.timestamp) {
//判断用户时间戳是否过期12小时
if (userInfo.timestamp && (Date.now() - userInfo.timestamp) > (1000 * 60 * 1440)) {
console.log('用户登录过期');
} else {
console.log('用户已经登录');
commit('SET_AUTHORIZE_PAGE', true);
return commit('SET_SHOW_WINDOW', true);
}
}
if (wwCode) {
ssoApi.login({ code: wwCode, corpId, getUserInfoFlag: false }).then(res => {
const { code, data, message } = res;
if (code == "0") {
commit('SET_AUTHORIZE_PAGE', true);
commit('SET_SHOW_WINDOW', true);
const hrefUrl = window.location.href;
const newUrl = hrefUrl.replace(/([?&])code=[^&]*/, (match, prefix) => { return prefix === '?' ? '?' : ''; });
window.history.replaceState({}, '', newUrl);
if (data.loginList && data.loginList.length) {
let [item] = data.loginList
if (item.loginList && item.loginList.length) {
let [userInfo] = item.loginList,
{ phone } = userInfo
if (phone) util.setLocalStorage('ww_params_phone', phone)
//获取当前时间戳
userInfo.timestamp = Date.now();
util.setLocalStorage('ww_userInfo', userInfo);
} else throw ''
} else throw ''
} else {
Notify({ message: message })
commit('SET_SHOW_WINDOW', false);
commit('SET_AUTHORIZE_PAGE', false);
}
})
} else {
commit('SET_AUTHORIZE_PAGE', false);
//是否企微环境
const ua = navigator.userAgent.toLowerCase()
if (Boolean(ua.match(/MicroMessenger/i)) && Boolean(ua.match(/wxwork/i))) {
window.location.href = `${loginUrl}?redirect_uri=${encodeURIComponent(window.location.href)}&corpId=${corpId}&agentId=${agentId}&backLoginCode=BACKCODE`
} else {
Notify({ message: '请使用企业微信打开', duration: 72000000 })
}
}
} catch (error) {
if (!error) error = '登录失败或无权限'
if (error) Notify(typeof error === 'string' ? error : error.toString())
}
} else { } else {
commit('SET_AUTHORIZE_PAGE', true); commit('SET_AUTHORIZE_PAGE', true)
commit('SET_SHOW_WINDOW', true); commit('SET_SHOW_WINDOW', true)
} }
}, },
navigation({ dispatch, commit }, to) { navigation({ dispatch, commit }) {
let { corpId, agentId, phone, name, id ,orderCode} = util.getQuery(), saveUrlParams()
userInfo = util.getLocalStorage('ww_userInfo') const userInfo = util.getLocalStorage('ww_userInfo')
if (phone) util.setLocalStorage('ww_params_phone', phone)
if (name) util.setLocalStorage('ww_params_name', name)
if (id) util.setLocalStorage('ww_params_id', id)
if (orderCode) util.setLocalStorage('ww_orderCode', orderCode)
dispatch('registerHttp') dispatch('registerHttp')
if (corpId) {
let ww_storage_info = {}
ww_storage_info.corpId = corpId
if (agentId && agentId != 'undefined') ww_storage_info.agentId = agentId
util.setLocalStorage('ww_storage_info', ww_storage_info)
}
if (userInfo) { if (userInfo) {
commit('SET_SHOW_WINDOW', true) commit('SET_SHOW_WINDOW', true)
} else { } else {
......
这是一个新员工开账号审核,页面样式跟src\views\orderApproval样式一模一样( 去掉商品信息)
基本信息的字段如下:
员工姓名:staffName
手机号:staffPhone
归属门店:merchantName
关联业务:staffSceneLabelText
驻店类型:stationType 门店常驻:1,临时调动支撑:2
区域运营:
提单时间:
后端接口还未提供,先用假数据显示当前页面,接口位置先提供,后期有的话我再替换
export default {
code: 0,
message: 'success',
data: {
id: 10001,
staffId: 20001,
staffName: '金晨',
staffPhone: '13893047470',
merchantId: 44212556,
merchantName: 'xxxx汽车销售服务有限公司',
sceneList: JSON.stringify([
{ sceneName: '权益' },
{ sceneName: '延保' }
]),
yqMerchantList: JSON.stringify([
{ yqMerchantName: 'D+西藏迅捷网界园区店', merchantId: 44212979 }
]),
createdSource: 1,
stationType: 2,
submitterAccount: 'glsadmin',
submitterName: '区域运营人员',
submitterPhone: '13800000000',
submitterUuid: 'uuid-001',
approvalStatus: 0,
approverUuid: null,
approverName: null,
approvalTime: null,
approvalRemark: null
}
}
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<div class="container"> <div class="container">
<div class="label"> <div class="label">
{{ infoData.label }} {{ infoData.label }}
<span v-if="infoData.type == 2" class="required-label">*</span> <span v-if="infoData.type == 2 && rejectRemarkRequired" class="required-label">*</span>
</div> </div>
<div class="textarea-wrap"> <div class="textarea-wrap">
<van-field <van-field
...@@ -50,6 +50,10 @@ export default { ...@@ -50,6 +50,10 @@ export default {
show: { show: {
type: Boolean, type: Boolean,
default: false default: false
},
rejectRemarkRequired: {
type: Boolean,
default: false
} }
}, },
data() { data() {
...@@ -78,7 +82,7 @@ export default { ...@@ -78,7 +82,7 @@ export default {
}, },
methods: { methods: {
onConfirm() { onConfirm() {
if (this.infoData.type == 2 && !this.remark) { if (this.rejectRemarkRequired && this.infoData.type == 2 && !this.remark) {
Toast('请输入驳回备注') Toast('请输入驳回备注')
return return
} }
......
...@@ -9,7 +9,7 @@ export default { ...@@ -9,7 +9,7 @@ export default {
"sellerName": "wql", "sellerName": "wql",
"merchantId": 44212556, "merchantId": 44212556,
"merchantName": "0918测试1.1.2-门店", "merchantName": "0918测试1.1.2-门店",
"status": 2, "status":1,
"applyDate": 1769671815000, "applyDate": 1769671815000,
"orderRemark": "", "orderRemark": "",
"outTradeNo": "4gfged", "outTradeNo": "4gfged",
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!