Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
ujia
/
uj-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f4f08371
authored
Nov 10, 2026
by
chenwq
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat(scene): 优化场景选择逻辑,简化代码并移除冗余场景配置
1 parent
0346e090
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
47 additions
and
142 deletions
apps/mp/usedcar/pages/accountItems/accountItems.js
apps/mp/usedcar/pages/constant/data.js
apps/mp/usedcar/pages/loading/loading.js
apps/mp/usedcar/pages/sceneIndex/sceneIndex.js
apps/mp/usedcar/pages/sceneIndex/sceneIndex.wxml
apps/mp/usedcar/pages/wxLogin/wxLogin.js
apps/mp/usedcar/project.config.json
apps/mp/usedcar/pages/accountItems/accountItems.js
View file @
f4f0837
...
...
@@ -4,7 +4,6 @@ import api from '~/api/api'
import
{
checkLoginEnvironment
}
from
'~/utils/loginEnvironmentCheck'
const
app
=
getApp
()
import
{
getYQorderInfo
,
get4SStoreList
}
from
'~/store/index'
import
{
getShopSceneConfig
}
from
'~/store/index'
import
{
setUserInfo
}
from
'~/utils/cache/storageApi'
Page
({
/**
...
...
@@ -38,18 +37,18 @@ Page({
console
.
log
(
id
,
'id'
)
id
?
this
.
qrCodeScene
(
id
)
:
this
.
getListSelectAccount
()
},
/**
* 账号确认后进入门店选择,避免已保存的业务配置跳过用户确认步骤。
* @param {string|number} yqMerchantId 园区店商户标识
* @param {object} loginUserObj 已确认的账号信息
* @returns {Promise<void>}
*/
async
getSceneArr
(
yqMerchantId
,
loginUserObj
)
{
if
(
!
wx
.
$hasPermission
?.
canSkipValidation
?.(
loginUserObj
))
{
let
checkAgree
=
await
this
.
checkAgree
(
loginUserObj
)
if
(
!
checkAgree
)
return
false
}
if
(
wx
.
$hasPermission
?.
canSelectMultiStore
?.(
loginUserObj
))
return
// 获取4s店关联场景数据
getShopSceneConfig
({
yqMerchantId
}).
then
(
result
=>
{
if
(
!
result
?.
length
)
return
wx
.
$util
.
showToast
(
'暂无开通业务,请联系总部管理员'
)
this
.
get4SStoreList
(
loginUserObj
)
})
this
.
get4SStoreList
(
loginUserObj
)
},
open
()
{
this
.
setData
({
...
...
@@ -267,10 +266,6 @@ Page({
get4SStoreList
(
loginUserObj
)
{
let
{
merchantId
,
uuid
}
=
loginUserObj
const
canSkip
=
wx
.
$hasPermission
?.
canSelectMultiStore
?.(
loginUserObj
)
if
(
canSkip
)
{
wx
.
$router
.
go
(
'pages.sceneIndex'
)
return
}
get4SStoreList
(
{
merchantId
:
canSkip
?
undefined
:
merchantId
,
...
...
@@ -279,18 +274,12 @@ Page({
canSkip
,
true
).
then
(
result
=>
{
let
obj
=
(
result
&&
result
[
0
])
||
{}
// 仅一家4s店
if
(
result
?.
length
==
1
)
{
this
.
setShopMerchantObj
(
obj
)
wx
.
$router
.
go
(
'pages.sceneIndex'
)
}
else
if
(
!
result
?.
length
)
{
if
(
!
result
?.
length
)
{
return
wx
.
$util
.
showToast
(
'园区店关联的4s店商户账号无效,请联系总部管理员'
)
}
else
{
wx
.
$router
.
go
(
'pages.merchantList'
)
}
wx
.
$router
.
go
(
'pages.merchantList'
)
})
},
...
...
apps/mp/usedcar/pages/constant/data.js
View file @
f4f0837
const
sceneList
=
[
{
sceneName
:
'精品升级'
,
sceneDesc
:
'太阳膜升级转化下单'
,
sceneType
:
1
,
actived
:
false
,
recordId
:
1
,
},
{
sceneName
:
'会员权益/升级'
,
sceneDesc
:
'新车车损险下单'
,
sceneType
:
0
,
actived
:
false
,
recordId
:
2
,
},
{
sceneName
:
'售后众筹'
,
sceneDesc
:
'门店存量客户众筹下单'
,
sceneType
:
3
,
actived
:
false
,
recordId
:
3
,
},
{
sceneName
:
'次新车转化'
,
sceneDesc
:
'次新车用户领取套餐包转化'
,
sceneType
:
2
,
actived
:
false
,
recordId
:
4
,
},
{
sceneName
:
'二手车'
,
sceneDesc
:
'二手车业务'
,
sceneType
:
7
,
...
...
@@ -36,12 +8,7 @@ const sceneList = [
}
]
// 0 会员权益升级 1 精品升级 3 售后众筹 ,2次新车转化
const
pageUrl
=
{
0
:
'packageEquity.equityPage'
,
1
:
'tabIndex.index'
,
3
:
'packageCrowdFunding.crowdFundingPage'
,
2
:
'subvehicleConversion.conversionPage'
,
7
:
'packageUsedCar.usedCarPage'
}
...
...
apps/mp/usedcar/pages/loading/loading.js
View file @
f4f0837
...
...
@@ -105,4 +105,4 @@ Page({
this
.
initData
(
false
)
}
}
})
\ No newline at end of file
})
apps/mp/usedcar/pages/sceneIndex/sceneIndex.js
View file @
f4f0837
// pages/sceneIndex/sceneIndex.js
import
constantData
from
"../constant/data"
;
import
api
from
"~/api/api"
;
import
{
getShopSceneConfig
,
getBusinessSchoolScene
}
from
"~/store/index"
;
import
{
ImgUrl
}
from
"~/config"
;
// import reportPageTrackMixin from '~/mixins/reportPageTrackMixin'
Page
({
...
...
@@ -24,19 +23,11 @@ Page({
if
(
jumpPageFlag
)
return
;
this
.
setData
({
jumpPageFlag
:
true
});
let
userInfo
=
wx
.
$util
.
getUserInfo
();
if
(
!
openSceneArr
.
includes
(
scene
)
&&
!
wx
.
$hasPermission
?.
canSelectMultiStore
?.(
userInfo
)
)
{
if
(
!
openSceneArr
.
includes
(
Number
(
scene
)))
{
this
.
setData
({
jumpPageFlag
:
false
});
return
wx
.
$util
.
showToast
(
"暂未开通此场景"
);
}
// 非驻店人员不可进入二手车场景
if
(
wx
.
$hasPermission
?.
canSelectMultiStore
?.(
userInfo
)
&&
scene
==
7
)
{
this
.
setData
({
jumpPageFlag
:
false
})
return
wx
.
$util
.
showToast
(
"暂未开放"
)
return
wx
.
$util
.
showToast
(
"暂未开通二手车场景"
);
}
sceneList
.
map
((
i
)
=>
(
i
.
actived
=
false
));
sceneList
[
index
].
actived
=
true
;
// if (userInfo?.isSuper) {
...
...
@@ -96,50 +87,33 @@ Page({
});
this
.
getSceneArr
();
},
selectBusinessschoo
()
{
// wx.$router.go('packageEquity.collegeScene', { reLaunchPath: 'pages.sceneIndex' })
wx
.
$router
.
go
(
"packageEquity.collegeScene"
);
},
/**
* 查询当前账号在已选门店开通的二手车场景,阻止未开通账号进入业务首页。
* @returns {Promise<void>}
*/
getSceneArr
()
{
// 超管默认开通全部场景
let
userInfo
=
wx
.
$util
.
getUserInfo
();
if
(
wx
.
$hasPermission
?.
isSuper
?.(
userInfo
))
return
this
.
setData
({
showPage
:
true
});
wx
.
$util
.
showLoading
();
// 获取4s店关联场景数据
getShopSceneConfig
({
yqMerchantId
:
userInfo
?.
subLoginUser
?.
merchantId
,
merchantId
:
wx
.
$hasPermission
?.
isSuper
?.(
userInfo
)
?
undefined
:
userInfo
?.
shopMerchantId
,
}).
then
((
result
)
=>
{
wx
.
$util
.
hideLoading
();
let
arr
=
result
?.
filter
(
v
=>
v
.
sceneOpenFlag
==
0
)?.
map
((
val
)
=>
{
return
val
.
scene
;
})
||
[];
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
if
(
arr
.
indexOf
(
arr
[
i
])
!==
i
)
{
arr
.
splice
(
i
,
1
);
i
--
;
api
.
getYqMerchantSceneConfigAPI
({
yqMerchantId
:
userInfo
?.
subLoginUser
?.
merchantId
,
merchantId
:
userInfo
?.
shopMerchantId
,
})
.
then
(({
code
,
data
,
message
})
=>
{
if
(
code
!=
0
)
{
wx
.
$util
.
showToast
(
message
);
return
;
}
}
// 仅开通一个场景直接进入场景页面
if
(
arr
.
length
==
1
)
{
wx
.
$util
.
setUserInfo
({
...
wx
.
$util
.
getUserInfo
(),
sceneType
:
arr
[
0
],
});
wx
.
$router
.
reLaunch
(
"pages.loading"
);
}
this
.
setData
({
openSceneArr
:
arr
,
showPage
:
true
});
});
getBusinessSchoolScene
({}).
then
((
res
)
=>
{
console
.
log
(
res
,
"res"
);
if
(
res
||
wx
.
$hasPermission
?.
isSuper
?.(
userInfo
))
{
this
.
setData
({
businessschooScene
:
true
,
});
}
// }
});
const
openSceneArr
=
(
data
||
[])
.
filter
((
item
)
=>
item
.
sceneOpenFlag
==
0
&&
item
.
scene
==
7
)
.
map
((
item
)
=>
Number
(
item
.
scene
));
this
.
setData
({
openSceneArr
});
})
.
catch
(()
=>
{
wx
.
$util
.
showToast
(
"场景开通状态查询失败"
);
})
.
finally
(()
=>
{
this
.
setData
({
showPage
:
true
});
});
},
/**
...
...
@@ -152,12 +126,8 @@ Page({
*/
onShow
()
{
let
{
sceneList
}
=
this
.
data
;
let
userInfo
=
wx
.
$util
.
getUserInfo
();
sceneList
.
map
((
i
)
=>
{
i
.
actived
=
false
;
if
(
i
.
sceneType
==
userInfo
?.
sceneType
)
{
i
.
actived
=
true
;
}
i
.
actived
=
i
.
sceneType
==
7
;
return
i
;
});
this
.
setData
({
sceneList
,
jumpPageFlag
:
false
});
...
...
apps/mp/usedcar/pages/sceneIndex/sceneIndex.wxml
View file @
f4f0837
...
...
@@ -12,21 +12,5 @@
</view>
</view>
</block>
<block wx:if="{{businessschooScene}}">
<view class="businessSchoolTitle">
工资绩效
</view>
<view class="businessSchoolBox">
<view class="scene-item {{item.actived ? 'active' : ''}}" bindtap="selectBusinessschoo">
<view class="left">
<image class="scene-icon" src="{{ImgUrl}}/crowdFunding/businessschoo.png" />
<view class="item-text">
<view class="name">工资绩效</view>
<view class="desc">员工绩效提成</view>
</view>
</view>
</view>
</view>
</block>
</scroll-view>
</view>
\ No newline at end of file
</view>
apps/mp/usedcar/pages/wxLogin/wxLogin.js
View file @
f4f0837
...
...
@@ -275,17 +275,12 @@ Page({
})
}
},
checkLoginMessage
(
needSelectAccount
,
loginUserObj
)
{
if
(
!
needSelectAccount
&&
Object
.
keys
(
loginUserObj
)?.
length
&&
(
loginUserObj
?.
shopMerchantId
||
wx
.
$hasPermission
?.
canSelectMultiStore
?.(
loginUserObj
))
&&
!
((
loginUserObj
?.
sceneType
??
''
)
===
''
))
{
this
.
getYqMerchantSceneConfig
(
loginUserObj
,
0
)
}
else
if
(
!
needSelectAccount
&&
Object
.
keys
(
loginUserObj
)?.
length
&&
loginUserObj
?.
shopMerchantId
&&
(
loginUserObj
?.
sceneType
??
''
)
===
''
)
{
// 已选园区店、4s店
this
.
getYqMerchantSceneConfig
(
loginUserObj
,
1
)
}
else
if
(
!
needSelectAccount
)
{
// 仅选择园区店
this
.
getYqMerchantSceneConfig
(
loginUserObj
,
2
)
}
else
{
// 未记录到登录信息
// this.getAccountLoginList(loginUserInfoList)
this
.
getAccountLoginList
(
needSelectAccount
)
}
/**
* 登录成功后统一从账号选择开始,避免接口缓存的选择状态跳过账号、门店或场景步骤。
* @returns {void}
*/
checkLoginMessage
()
{
wx
.
$router
.
reLaunch
(
'pages.accountItems'
)
},
playCountDown
()
{
let
{
...
...
@@ -733,4 +728,4 @@ Page({
* 页面上拉触底事件的处理函数
*/
onReachBottom
:
function
()
{
}
})
\ No newline at end of file
})
apps/mp/usedcar/project.config.json
View file @
f4f0837
...
...
@@ -256,6 +256,6 @@
"tabIndent"
:
"insertSpaces"
,
"tabSize"
:
2
},
"appid"
:
"wx
570d9331f9ace0bd
"
,
"appid"
:
"wx
39a574d259fe58a0
"
,
"simulatorPluginLibVersion"
:
{}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment