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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
108 additions
and
36 deletions
+108
-36
src/api/shop.js
+7
-0
src/pages/home/index.vue
+96
-35
src/pages/index/index.vue
+5
-1
No files found.
src/api/shop.js
View file @
5f3ca3e5
...
@@ -94,6 +94,13 @@ export default {
...
@@ -94,6 +94,13 @@ export default {
data
data
);
);
},
},
// 进店规则获取门店id预进入门店
getEnterShopIdV1
(
data
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/enterShopRule/getEnterShopIdV1`
,
data
);
},
// 商城二维码分配组织或跟进人
// 商城二维码分配组织或跟进人
ShopCodeDistributionOrg
(
data
)
{
ShopCodeDistributionOrg
(
data
)
{
return
requestPOST
(
return
requestPOST
(
...
...
src/pages/home/index.vue
View file @
5f3ca3e5
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
</div>
-->
</div>
-->
<CustomNav
:customBgOpacity=
"customBgOpacity"
></CustomNav>
<CustomNav
:customBgOpacity=
"customBgOpacity"
></CustomNav>
<StoreAddr
v-if=
"showStoreAddr"
@
toUpdate=
"reloadEnterShopRule"
@
toPageLoading=
"toPageLoading"
ref=
"StoreAddr"
></StoreAddr>
<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-for=
"(item,index) in pageData"
:key=
"index"
>
<div
v-if=
"item.componentCode=='banner' && item.componentInfo.visible == 1"
>
<div
v-if=
"item.componentCode=='banner' && item.componentInfo.visible == 1"
>
<banner
:datas=
"item"
></banner>
<banner
:datas=
"item"
></banner>
...
@@ -204,22 +204,22 @@ export default {
...
@@ -204,22 +204,22 @@ export default {
pageInfo
:
{},
pageInfo
:
{},
pageData
:
[],
pageData
:
[],
contentList
:
[],
contentList
:
[],
themeColor
:{
themeColor
:
{
'--main-color'
:
""
,
'--main-color'
:
""
,
'--minor-color'
:
""
,
'--minor-color'
:
""
,
},
},
changeLocation
:
''
,
changeLocation
:
''
,
beforeScrollTop
:
0
,
beforeScrollTop
:
0
,
showSpokesManHome
:
false
,
//分销商货架是否展示
showSpokesManHome
:
false
,
//分销商货架是否展示
showMyCard
:
false
,
showMyCard
:
false
,
showHomepage
:
false
,
//分销商首页入口
showHomepage
:
false
,
//分销商首页入口
applySucessEntry
:
false
,
//成为分销弹框
applySucessEntry
:
false
,
//成为分销弹框
getDistributorHomepageName
:
''
,
//小店入口名称
getDistributorHomepageName
:
''
,
//小店入口名称
active
:
-
1
,
active
:
-
1
,
toHomePage
:
false
,
//是否分销隔断
toHomePage
:
false
,
//是否分销隔断
options
:
1
,
options
:
1
,
// 新人有礼
// 新人有礼
newGiftList
:[],
newGiftList
:
[],
newCustomerGiftActivityId
:
""
,
//新客活动id
newCustomerGiftActivityId
:
""
,
//新客活动id
showNewUser
:
false
,
//新客有礼入口
showNewUser
:
false
,
//新客有礼入口
showgiftBag
:
false
,
//新客礼包弹框
showgiftBag
:
false
,
//新客礼包弹框
...
@@ -237,6 +237,9 @@ export default {
...
@@ -237,6 +237,9 @@ export default {
customBgOpacity
:
true
,
// 沉浸式风格
customBgOpacity
:
true
,
// 沉浸式风格
reloadPage
:
false
,
// 切换门店进入首页重新获取相关配置
reloadPage
:
false
,
// 切换门店进入首页重新获取相关配置
showStoreAddr
:
false
,
showStoreAddr
:
false
,
preEntryStoreId
:
""
,
// 预进入门店code
preEntryStore
:
{},
// 预进入门店
storeDetail
:
{},
};
};
},
},
components
:{
components
:{
...
@@ -570,8 +573,6 @@ export default {
...
@@ -570,8 +573,6 @@ export default {
}
}
// 新人有礼弹窗
// 新人有礼弹窗
this
.
newUserFun
();
this
.
newUserFun
();
// 新店调试
this
.
debugShopFun
();
//清除商品列表组件懒加载缓存
//清除商品列表组件懒加载缓存
// 需清除的缓存keyList
// 需清除的缓存keyList
...
@@ -617,6 +618,8 @@ export default {
...
@@ -617,6 +618,8 @@ export default {
}
}
},
},
async
enterStoreRule
()
{
async
enterStoreRule
()
{
let
_this
=
this
;
await
this
.
getEnterShopIdV1
();
try
{
try
{
console
.
log
(
wx
.
getStorageSync
(
"locationObj"
),
'--locationObj'
)
console
.
log
(
wx
.
getStorageSync
(
"locationObj"
),
'--locationObj'
)
let
locationObj
=
wx
.
getStorageSync
(
"locationObj"
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
"locationObj"
))
:
{};
let
locationObj
=
wx
.
getStorageSync
(
"locationObj"
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
"locationObj"
))
:
{};
...
@@ -631,37 +634,93 @@ export default {
...
@@ -631,37 +634,93 @@ export default {
console
.
log
(
`%cgetEnterShopId
${
JSON
.
stringify
(
res
)}
`
,
'color:yellow;font-size:20px;'
)
console
.
log
(
`%cgetEnterShopId
${
JSON
.
stringify
(
res
)}
`
,
'color:yellow;font-size:20px;'
)
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
code
==
200
)
{
let
enterShopId
=
res
.
data
.
data
;
let
enterShopId
=
res
.
data
.
data
;
console
.
log
(
enterShopId
,
'--enterShopId'
)
console
.
log
(
enterShopId
,
'--enterShopId'
);
if
(
enterShopId
)
{
let
storeDetail
=
await
shop
.
getOfflineStoreDetail
({
let
storeDetail
=
await
shop
.
getOfflineStoreDetail
({
shopId
:
enterShopId
,
shopId
:
enterShopId
,
});
});
if
(
storeDetail
.
data
.
code
==
200
)
{
if
(
storeDetail
.
data
.
code
==
200
)
{
this
.
storeDetail
=
storeDetail
.
data
.
data
;
setStoreInfo
({
}
offlineShopCode
:
storeDetail
.
data
.
data
.
shopCode
,
console
.
log
(
'enterStoreRule->'
,
this
.
preEntryStoreId
,
enterShopId
)
offlineShopName
:
storeDetail
.
data
.
data
.
shopName
,
if
(
this
.
preEntryStoreId
&&
this
.
preEntryStoreId
!=
enterShopId
)
{
});
wx
.
showModal
({
this
.
$refs
.
StoreAddr
.
reloadName
();
title
:
'提醒'
,
console
.
log
(
"refreshInit--------3"
)
content
:
`当前定位最近门店【
${
this
.
storeDetail
.
shopName
}
】是否要进入该门店?`
,
this
.
refreshInit
();
success
(
res
)
{
}
if
(
res
.
confirm
)
{
console
.
log
(
storeDetail
,
'-------storeDetail'
);
_this
.
enterStore
(
enterShopId
);
let
loginUserInfo
=
wx
.
getStorageSync
(
"loginUserInfo"
)
||
null
;
}
else
if
(
res
.
cancel
)
{
let
query2
=
{
console
.
log
(
'用户点击取消'
)
telephoneNum
:
loginUserInfo
&&
loginUserInfo
.
mobilephone
,
_this
.
setPageLoading
();
enterShopSource
:
"买家直接进入"
,
}
hitRule
:
"首页进入"
,
}
shopName
:
storeDetail
.
data
.
data
.
shopName
,
})
}
}
else
{
log
.
info
(
"进店规则-----"
,
query2
)
await
this
.
enterStore
(
enterShopId
);
shop
.
saveEnterShopRecord
(
query2
);
}
}
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
'enterStoreRule-error->'
,
error
)
}
}
// this.setPageLoading();
// 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
:
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
(
this
.
storeDetail
,
'-------this.storeDetail'
);
let
loginUserInfo
=
wx
.
getStorageSync
(
"loginUserInfo"
)
||
null
;
let
query2
=
{
telephoneNum
:
loginUserInfo
&&
loginUserInfo
.
mobilephone
,
enterShopSource
:
"买家直接进入"
,
hitRule
:
"首页进入"
,
shopName
:
this
.
storeDetail
.
shopName
,
}
log
.
info
(
"进店规则-----"
,
query2
)
shop
.
saveEnterShopRecord
(
query2
);
}
},
getOfflineStoreDetail
()
{
},
toPageLoading
()
{
toPageLoading
()
{
},
},
async
setVisible
(
pageList
,
cb
)
{
async
setVisible
(
pageList
,
cb
)
{
...
@@ -1190,6 +1249,8 @@ export default {
...
@@ -1190,6 +1249,8 @@ export default {
}
catch
(
error
)
{
}
catch
(
error
)
{
}
}
// 新店调试
this
.
debugShopFun
();
wx
.
stopPullDownRefresh
();
wx
.
stopPullDownRefresh
();
},
},
ShopCodeDistributionOrg
()
{
ShopCodeDistributionOrg
()
{
...
...
src/pages/index/index.vue
View file @
5f3ca3e5
...
@@ -159,7 +159,11 @@ export default {
...
@@ -159,7 +159,11 @@ export default {
}
}
},
},
onLoad
(
options
)
{
onLoad
(
options
)
{
wx
.
removeStorageSync
(
"firstView"
);
let
{
offlineShopCode
,
offlineShopName
}
=
getStoreInfo
();
// 新用户首次扫码进入此页没缓存认定为第一次访问
if
(
offlineShopCode
)
{
wx
.
removeStorageSync
(
"firstView"
);
}
console
.
log
(
options
,
'---options'
)
console
.
log
(
options
,
'---options'
)
if
(
wx
.
getStorageSync
(
"sessionid"
))
{
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