Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
5f3ca3e5
Commit
5f3ca3e5
authored
May 08, 2024
by
李嘉林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat: 进店规则优化
parent
b220d8b5
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
92 additions
and
20 deletions
+92
-20
src/api/shop.js
+7
-0
src/pages/home/index.vue
+81
-20
src/pages/index/index.vue
+4
-0
No files found.
src/api/shop.js
View file @
5f3ca3e5
...
...
@@ -94,6 +94,13 @@ export default {
data
);
},
// 进店规则获取门店id预进入门店
getEnterShopIdV1
(
data
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/enterShopRule/getEnterShopIdV1`
,
data
);
},
// 商城二维码分配组织或跟进人
ShopCodeDistributionOrg
(
data
)
{
return
requestPOST
(
...
...
src/pages/home/index.vue
View file @
5f3ca3e5
...
...
@@ -7,7 +7,7 @@
</div>
-->
<CustomNav
:customBgOpacity=
"customBgOpacity"
></CustomNav>
<StoreAddr
v-if=
"showStoreAddr"
@
toUpdate=
"reloadEnterShopRule"
@
toPageLoading=
"toPageLoading"
ref=
"StoreAddr"
></StoreAddr>
<ThemeDataPlant></ThemeDataPlant>
<ThemeDataPlant
v-if=
"!pageLoading"
></ThemeDataPlant>
<div
v-for=
"(item,index) in pageData"
:key=
"index"
>
<div
v-if=
"item.componentCode=='banner' && item.componentInfo.visible == 1"
>
<banner
:datas=
"item"
></banner>
...
...
@@ -204,22 +204,22 @@ export default {
pageInfo
:
{},
pageData
:
[],
contentList
:
[],
themeColor
:{
'--main-color'
:
""
,
'--minor-color'
:
""
,
themeColor
:
{
'--main-color'
:
""
,
'--minor-color'
:
""
,
},
changeLocation
:
''
,
beforeScrollTop
:
0
,
changeLocation
:
''
,
beforeScrollTop
:
0
,
showSpokesManHome
:
false
,
//分销商货架是否展示
showMyCard
:
false
,
showHomepage
:
false
,
//分销商首页入口
applySucessEntry
:
false
,
//成为分销弹框
getDistributorHomepageName
:
''
,
//小店入口名称
active
:
-
1
,
active
:
-
1
,
toHomePage
:
false
,
//是否分销隔断
options
:
1
,
// 新人有礼
newGiftList
:[],
newGiftList
:
[],
newCustomerGiftActivityId
:
""
,
//新客活动id
showNewUser
:
false
,
//新客有礼入口
showgiftBag
:
false
,
//新客礼包弹框
...
...
@@ -237,6 +237,9 @@ export default {
customBgOpacity
:
true
,
// 沉浸式风格
reloadPage
:
false
,
// 切换门店进入首页重新获取相关配置
showStoreAddr
:
false
,
preEntryStoreId
:
""
,
// 预进入门店code
preEntryStore
:
{},
// 预进入门店
storeDetail
:
{},
};
},
components
:{
...
...
@@ -570,8 +573,6 @@ export default {
}
// 新人有礼弹窗
this
.
newUserFun
();
// 新店调试
this
.
debugShopFun
();
//清除商品列表组件懒加载缓存
// 需清除的缓存keyList
...
...
@@ -617,6 +618,8 @@ export default {
}
},
async
enterStoreRule
()
{
let
_this
=
this
;
await
this
.
getEnterShopIdV1
();
try
{
console
.
log
(
wx
.
getStorageSync
(
"locationObj"
),
'--locationObj'
)
let
locationObj
=
wx
.
getStorageSync
(
"locationObj"
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
"locationObj"
))
:
{};
...
...
@@ -631,36 +634,92 @@ export default {
console
.
log
(
`%cgetEnterShopId
${
JSON
.
stringify
(
res
)}
`
,
'color:yellow;font-size:20px;'
)
if
(
res
.
data
.
code
==
200
)
{
let
enterShopId
=
res
.
data
.
data
;
console
.
log
(
enterShopId
,
'--enterShopId'
)
if
(
enterShopId
)
{
console
.
log
(
enterShopId
,
'--enterShopId'
);
let
storeDetail
=
await
shop
.
getOfflineStoreDetail
({
shopId
:
enterShopId
,
});
if
(
storeDetail
.
data
.
code
==
200
)
{
this
.
storeDetail
=
storeDetail
.
data
.
data
;
}
console
.
log
(
'enterStoreRule->'
,
this
.
preEntryStoreId
,
enterShopId
)
if
(
this
.
preEntryStoreId
&&
this
.
preEntryStoreId
!=
enterShopId
)
{
wx
.
showModal
({
title
:
'提醒'
,
content
:
`当前定位最近门店【
${
this
.
storeDetail
.
shopName
}
】是否要进入该门店?`
,
success
(
res
)
{
if
(
res
.
confirm
)
{
_this
.
enterStore
(
enterShopId
);
}
else
if
(
res
.
cancel
)
{
console
.
log
(
'用户点击取消'
)
_this
.
setPageLoading
();
}
}
})
}
else
{
await
this
.
enterStore
(
enterShopId
);
}
}
}
catch
(
error
)
{
console
.
log
(
'enterStoreRule-error->'
,
error
)
}
// this.setPageLoading();
},
async
getEnterShopIdV1
()
{
this
.
preEntryStoreId
=
""
;
try
{
let
res
=
await
shop
.
getEnterShopIdV1
({
channelType
:
2
,
consumerLongitude
:
""
,
consumerLatitude
:
""
,
distributionOfficerShopCode
:
""
});
if
(
res
.
data
.
code
==
200
&&
!
isNaN
(
res
.
data
.
data
-
0
))
{
this
.
preEntryStoreId
=
res
.
data
.
data
;
let
storeDetail
=
await
shop
.
getOfflineStoreDetail
({
shopId
:
this
.
preEntryStoreId
,
});
if
(
storeDetail
.
data
.
code
==
200
)
{
this
.
storeDetail
=
storeDetail
.
data
.
data
;
}
await
this
.
enterStore
(
this
.
preEntryStoreId
);
}
}
catch
(
error
)
{
console
.
log
(
'getEnterShopIdV1-error->'
,
error
)
}
},
async
enterStore
(
enterId
)
{
if
(
enterId
)
{
if
(
this
.
storeDetail
.
shopCode
)
{
setStoreInfo
({
offlineShopCode
:
storeDetail
.
data
.
data
.
shopCode
,
offlineShopName
:
storeDetail
.
data
.
data
.
shopName
,
offlineShopCode
:
this
.
storeDetail
.
shopCode
,
offlineShopName
:
this
.
storeDetail
.
shopName
,
});
this
.
$refs
.
StoreAddr
.
reloadName
();
console
.
log
(
"refreshInit--------3"
)
// this.refreshInit();
let
that
=
this
;
console
.
log
(
"onPullDownRefresh"
);
console
.
log
(
"refreshInit--------4"
)
this
.
refreshInit
();
this
.
mpApp
.
pageCallBack
=
function
(
params
)
{
console
.
log
(
"获取页面数据-3"
,
params
)
that
.
init
(
params
);
};
}
console
.
log
(
storeDetail
,
'-------
storeDetail'
);
console
.
log
(
this
.
storeDetail
,
'-------this.
storeDetail'
);
let
loginUserInfo
=
wx
.
getStorageSync
(
"loginUserInfo"
)
||
null
;
let
query2
=
{
telephoneNum
:
loginUserInfo
&&
loginUserInfo
.
mobilephone
,
enterShopSource
:
"买家直接进入"
,
hitRule
:
"首页进入"
,
shopName
:
storeDetail
.
data
.
data
.
shopName
,
shopName
:
this
.
storeDetail
.
shopName
,
}
log
.
info
(
"进店规则-----"
,
query2
)
shop
.
saveEnterShopRecord
(
query2
);
}
}
}
catch
(
error
)
{
},
getOfflineStoreDetail
(
)
{
}
// this.setPageLoading();
},
toPageLoading
()
{
},
...
...
@@ -1190,6 +1249,8 @@ export default {
}
catch
(
error
)
{
}
// 新店调试
this
.
debugShopFun
();
wx
.
stopPullDownRefresh
();
},
ShopCodeDistributionOrg
()
{
...
...
src/pages/index/index.vue
View file @
5f3ca3e5
...
...
@@ -159,7 +159,11 @@ export default {
}
},
onLoad
(
options
)
{
let
{
offlineShopCode
,
offlineShopName
}
=
getStoreInfo
();
// 新用户首次扫码进入此页没缓存认定为第一次访问
if
(
offlineShopCode
)
{
wx
.
removeStorageSync
(
"firstView"
);
}
console
.
log
(
options
,
'---options'
)
if
(
wx
.
getStorageSync
(
"sessionid"
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment