Commit 0088076f by 前端

Merge branch 'SAAS+V5.8.3' into 'master'

上线合并

See merge request !23
2 parents 56b771cc a5d5c86d
...@@ -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-car-boutique/router'
export default {
/** 获取订单待审核详情 */
getOrderApplyDetail(data = {}) {
data.method = 'dj.api.smartcarlife.goodsOrderApplyRecord.detail.select'
return window.$HTTP({
url,
data,
returnAll: true
})
},
/** 订单申请审核 */
auditOrderApply(data = {}) {
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({
url,
data,
returnAll: true
})
}
}
...@@ -108,6 +108,30 @@ const pages = { ...@@ -108,6 +108,30 @@ const pages = {
showAction: true showAction: true
} }
}, },
],
orderApproval:[
{
name: 'index',
meta: {
keepAlive: true,
title: '审核详情',
noAuth: true,
backgroundColor: '#f7f8fa',
showAction: true
}
}
],
accountApproval:[
{
name: 'index',
meta: {
keepAlive: true,
title: '新员工开账号审批',
noAuth: true,
backgroundColor: '#f7f8fa',
showAction: true
}
}
] ]
} }
let routes = [ let routes = [
......
...@@ -21,6 +21,84 @@ const state = { ...@@ -21,6 +21,84 @@ 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) {
if (userInfo.phone) util.setLocalStorage('ww_params_phone', userInfo.phone)
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') {
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)
commit('SET_AUTHORIZE_PAGE', true)
commit('SET_SHOW_WINDOW', true)
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,95 +127,24 @@ const actions = { ...@@ -49,95 +127,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 } = 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)
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
}
}
<template>
<van-popup round v-model="visible" position="bottom" :style="{ height: '68%' }" class="popup" :close-on-click-overlay="false" @close="onClose">
<div class="title">{{ infoData.title }}</div>
<div class="content">
<div class="container">
<div class="label">
{{ infoData.label }}
<span v-if="infoData.type == 2 && rejectRemarkRequired" class="required-label">*</span>
</div>
<div class="textarea-wrap">
<van-field v-model="remark" type="textarea" placeholder="请输入" maxlength="200" rows="8" :autosize="{ maxHeight: 220 }" show-word-limit class="textarea-input" />
</div>
<div v-if="infoData.type == 1" class="tips">审核通过后将自动流转至线上运营审核</div>
</div>
</div>
<div class="btn-group">
<div class="btn cancel" @click="onCancel">取消</div>
<div class="btn confirm" @click="onConfirm">确定</div>
</div>
</van-popup>
</template>
<script>
import { Toast } from 'vant'
export default {
name: 'ApprovalPopup',
props: {
infoData: {
type: Object,
default: () => ({})
},
show: {
type: Boolean,
default: false
},
rejectRemarkRequired: {
type: Boolean,
default: false
}
},
data() {
return {
remark: ''
}
},
computed: {
visible: {
get() {
return this.show
},
set(val) {
if (!val) {
this.$emit('cancel')
}
}
}
},
watch: {
show(val) {
if (val) {
this.remark = ''
}
}
},
methods: {
onConfirm() {
if (this.rejectRemarkRequired && this.infoData.type == 2 && !this.remark) {
Toast('请输入驳回备注')
return
}
this.$emit('confirm', this.remark)
},
onCancel() {
this.$emit('cancel')
},
onClose() {
this.$emit('cancel')
}
}
}
</script>
<style scoped lang="scss">
.popup {
.title {
height: 55px;
line-height: 55px;
color: #333333;
font-size: 16px;
text-align: center;
border-bottom: 1px solid #eff0f2;
}
.content {
height: calc(100% - 111px);
overflow-y: auto;
}
.container {
padding: 0 16px;
.label {
margin: 16px 0 8px;
font-size: 14px;
color: #222222;
.required-label {
color: #f24724;
}
}
.textarea-wrap {
.textarea-input {
background: #f4f5f7;
border-radius: 14px;
padding: 4px 0;
::v-deep .van-field__control {
padding: 12px;
}
}
}
.tips {
color: #999999;
font-size: 13px;
margin: 8px 0;
}
}
.btn-group {
display: flex;
align-items: center;
justify-content: space-between;
margin: 0 16px;
.btn {
flex: 1;
border-radius: 6px;
height: 41px;
line-height: 41px;
font-size: 16px;
text-align: center;
}
.cancel {
border: 1px solid #dee0e3;
background: #f4f5f7;
color: #292d33;
}
.confirm {
background: #347bff;
color: #ffffff;
margin-left: 11px;
}
}
}
</style>
<template>
<div class="section">
<div class="section-title">{{ title }}</div>
<!-- 普通商品 -->
<div v-for="(item, index) in goodsData.subOrderList || []" :key="'sub-' + index" class="order-item">
<div class="flex just-space flex-start">
<div class="item-left">
<div class="flex flex-start">
<span class="dot"></span>
<span class="name">{{ item.upgradeGoodsName }}</span>
</div>
<div class="gray pl-24">
<span class="price-label">商品单价¥{{ item.upgradePrice }}</span>
<span v-if="item.discountType == 4" class="tag">赠品</span>
</div>
</div>
<div class="item-right">
<div class="price">¥{{ item.singleProductFinalPrice }}</div>
<div class="gray">
共<span class="split">{{ item.number }}</span>件
</div>
</div>
</div>
<div class="gray pl-24">
<span>商品销售单价¥{{ item.singleProductSalesPrice }}</span>
<template v-if="item.discountType && (item.discountType == 1 || item.discountType == 2)">
<span class="split">|</span>
<span v-if="item.discountType == 1">{{ item.discountValue }}折</span>
<span v-else>折扣¥{{ item.discountValue }}</span>
</template>
</div>
</div>
<!-- 套餐商品 -->
<div v-for="(item, index) in goodsData.packageGoodsList || []" :key="'pkg-' + index" class="order-item">
<div class="item flex just-space package-item">
<div class="item-left flex flex-start">
<span class="dot"></span>
<span class="name">{{ item.packageName }}</span>
</div>
<div class="item-right">
<span class="price">¥{{ item.packagePrice }}</span>
</div>
</div>
<div class="package-list">
<div
v-for="(subItem, subIndex) in item.packageGoodsOrderList || []"
:key="subIndex"
class="list-item"
>
<div class="flex just-space flex-start">
<div class="item-left">
<div class="flex flex-start pl-24">
<span class="name">{{ subItem.upgradeGoodsName }}</span>
</div>
<div class="gray pl-24">
<span class="price-label">商品单价¥{{ subItem.upgradePrice }}</span>
<span v-if="subItem.discountType == 4" class="tag">赠品</span>
</div>
</div>
<div class="item-right">
<div class="price">¥{{ subItem.singleProductFinalPrice }}</div>
<div class="gray">
共<span class="split">{{ subItem.number }}</span>件
</div>
</div>
</div>
<div class="gray pl-24">
<span>商品销售单价¥{{ subItem.singleProductSalesPrice }}</span>
<template v-if="subItem.discountType && (subItem.discountType == 1 || subItem.discountType == 2)">
<span class="split">|</span>
<span v-if="subItem.discountType == 1">{{ subItem.discountValue }}折</span>
<span v-else>折扣¥{{ subItem.discountValue }}</span>
</template>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'GoodsOrderItem',
props: {
title: {
type: String,
default: '商品信息'
},
goodsData: {
type: Object,
default: () => ({
subOrderList: [],
packageGoodsList: []
})
}
}
}
</script>
<style scoped lang="scss">
.flex {
display: flex;
align-items: center;
}
.flex-start {
align-items: flex-start;
}
.just-space {
justify-content: space-between;
}
.section {
border-radius: 16px;
background: #ffffff;
margin: 12px 0;
padding: 12px 16px;
.section-title {
font-size: 15px;
font-weight: 500;
color: #222222;
margin-bottom: 12px;
}
.order-item {
border-radius: 10px;
background: #f7f8fa;
padding: 12px;
margin-bottom: 12px;
color: #222222;
font-size: 13px;
&:last-child {
margin-bottom: 0;
}
.package-item {
margin-bottom: 12px;
}
.name {
width: 205px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
word-break: break-all;
}
.dot {
display: inline-block;
width: 6px;
height: 6px;
border-radius: 50%;
background: #347bff;
margin: 6px 6px 0 0;
flex-shrink: 0;
}
.gray {
font-size: 12px;
color: #999999;
margin-top: 4px;
.price-label {
margin-right: 6px;
}
.tag {
display: inline-block;
width: 28px;
height: 14px;
line-height: 14px;
border-radius: 3px;
border: 1px solid #f4a08f;
text-align: center;
color: #f24724;
font-size: 12px;
}
}
.item-right {
text-align: right;
flex-shrink: 0;
}
.pl-24 {
padding-left: 12px;
}
.split {
margin: 0 6px;
}
.package-list {
.list-item {
padding: 12px;
margin: 0 -12px;
border-top: 1px solid #dfe4f2;
&:last-child {
padding-bottom: 0;
}
}
}
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!