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
402a60ed
Commit
402a60ed
authored
Feb 27, 2023
by
李嘉林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
选择门店
parent
6641f197
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
256 additions
and
48 deletions
+256
-48
src/api/shop.js
+21
-17
src/components/common/StoreAddr.vue
+171
-0
src/components/tabbarPage.vue
+12
-7
src/main.js
+1
-2
src/pages/home/index.vue
+25
-13
src/pages/index/index.vue
+17
-2
src/pages/order/index.vue
+6
-0
src/store/mutations.js
+0
-3
src/store/state.js
+0
-1
src/utils/mayi.js
+0
-0
src/utils/request.js
+3
-3
No files found.
src/api/shop.js
View file @
402a60ed
import
{
requestPOST
,
requestPOST1
}
from
"@/utils/request.js"
;
export
default
{
getShopInfo
()
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/shop/get_shop_info`
);
...
...
@@ -12,14 +11,13 @@ export default {
},
addWxMiniSubscribeMessageRecord
(
data
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/shop/addWxMiniSubscribeMessageRecord`
,
data
`
${
process
.
env
.
OLSHOP_URL
}
/shop/addWxMiniSubscribeMessageRecord`
,
data
);
},
// 页面数据
themePagesInfo
(
params
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/cms/get_shop_install_pages?homePageFlag=
${
params
.
homePageFlag
||
false
}
`
,
params
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/cms/get_shop_install_pages?homePageFlag=
${
params
.
homePageFlag
||
false
}
&shopMixId=
${
params
.
shopMixId
}
`
,
);
},
checkShowCondition
(
params
)
{
...
...
@@ -30,12 +28,9 @@ export default {
},
// 获取新版会员卡列表
getV3CardList
(
params
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/user/membership_card_list`
,
{
params
}
);
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/user/membership_card_list`
,
{
params
});
},
// 领取新版无门槛会员卡
drawV3Card
(
params
)
{
...
...
@@ -45,13 +40,22 @@ export default {
},
//获取shop配置
get_shop_configuration
(){
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/shop/get_shop_configuration`
);
get_shop_configuration
()
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/shop/get_shop_configuration`
);
},
// 获取系统配置
get_system_config_by_code
(
params
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/common/get_system_config_by_code?code=
${
params
.
code
}
`
)
},
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/common/get_system_config_by_code?code=
${
params
.
code
}
`
);
},
// 首页获取线下门店列表
getThousandsStoresOfflineStore
(
data
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/shop/get_thousands_stores_offline_store`
,
data
);
}
};
src/components/common/StoreAddr.vue
0 → 100644
View file @
402a60ed
<
template
>
<div
class=
"storeAddr flex"
v-if=
"openThousandsStoresFlag"
>
<div
class=
"left flex"
>
<div
class=
"logo"
>
<image
:src=
"shopLogo"
alt=
""
></image>
</div>
<div
class=
"contentInfo flex"
v-if=
"name != ''"
>
<p
class=
"info"
>
{{
name
}}
</p>
<p
class=
"change"
@
click=
"pushStorePage"
>
[切换]
</p>
</div>
</div>
</div>
</
template
>
<
script
>
import
shop
from
"@/api/shop"
;
import
{
DFSImg
}
from
"@/utils/index"
;
import
{
setStoreInfo
,
getStoreInfo
}
from
"@/utils/mayi"
const
app
=
getApp
();
export
default
{
data
()
{
return
{
show
:
false
,
name
:
""
,
storeList
:
[],
userLatitude
:
""
,
//纬度
userLongitude
:
""
,
//经度
offlineStoreReq
:
{
latitude
:
""
,
longitude
:
""
,
pageNum
:
0
,
pageSize
:
100
,
shopName
:
""
,
whetherOnlineShop
:
1
//是否网店(0:不是,1:是) 给1 或 null
}
};
},
onLoad
()
{
this
.
getShopList
();
},
computed
:
{
shopName
()
{
return
app
.
globalData
.
shopInfo
.
shopName
;
},
shopLogo
()
{
return
DFSImg
(
app
.
globalData
.
shopInfo
.
logoUrl
,
400
,
400
);
},
// 开启连锁商城(千店千面)
openThousandsStoresFlag
()
{
return
app
.
globalData
.
shopInfo
.
openThousandsStoresFlag
==
1
}
},
methods
:
{
getShopList
()
{
if
(
!
this
.
openThousandsStoresFlag
)
{
// 未开启连锁商城初始化
setStoreInfo
({
offlineShopCode
:
""
,
offlineShopName
:
""
,
});
return
;
};
shop
.
getThousandsStoresOfflineStore
(
this
.
offlineStoreReq
).
then
(
res1
=>
{
let
res
=
res1
.
data
;
if
(
res
.
code
==
200
)
{
if
(
res
.
data
&&
res
.
data
.
length
!=
0
)
{
this
.
storeList
=
res
.
data
;
let
isStore
=
false
;
let
{
offlineShopName
,
offlineShopCode
}
=
getStoreInfo
();
console
.
log
(
offlineShopName
,
offlineShopCode
,
'------------------sa114'
)
this
.
storeList
.
forEach
((
item
,
index
)
=>
{
if
(
item
.
shopName
==
offlineShopName
)
{
isStore
=
true
;
}
else
if
(
offlineShopCode
==
""
)
{
isStore
=
true
;
}
});
console
.
log
(
offlineShopName
,
isStore
,
"sa97"
);
if
(
offlineShopName
&&
isStore
)
{
console
.
log
(
"判断列表中是否存在(未关闭网店)"
);
this
.
name
=
offlineShopName
;
// this.$emit("toUpdate");
}
else
{
console
.
log
(
"如果关闭网店,重新选择列表第一个"
);
setStoreInfo
({
offlineShopCode
:
this
.
storeList
[
0
].
shopCode
,
offlineShopName
:
this
.
storeList
[
0
].
shopName
,
});
this
.
name
=
this
.
storeList
[
0
].
shopName
;
// this.$emit("toUpdate");
}
// this.$emit("toUpdate");
}
else
{
console
.
log
(
"如果列表为空--选择商城"
);
setStoreInfo
({
offlineShopCode
:
""
,
offlineShopName
:
this
.
shopName
,
});
this
.
name
=
this
.
shopName
;
}
}
});
},
// 去切换门店页面
pushStorePage
()
{
app
.
$themeToLink
({
type
:
1
,
link
:
`/chooseStores`
,
})
}
}
};
</
script
>
<
style
lang=
"scss"
scoped
>
.storeAddr
{
padding
:
6px
12px
;
justify-content
:
space-between
;
.left,
.right
{
align-items
:
center
;
i.iconfont
{
font-size
:
22px
;
margin
:
0
5px
;
}
}
.left
{
align-items
:
center
;
.contentInfo
{
align-items
:
flex-start
;
.info
{
font-size
:
14px
;
color
:
#999
;
flex
:
1
;
}
.change
{
flex-shrink
:
0
;
padding-left
:
6px
;
color
:
#333
;
font-size
:
14px
;
}
}
.logo
{
width
:
30px
;
height
:
30px
;
border-radius
:
50%
;
overflow
:
hidden
;
margin-right
:
10px
;
image
{
width
:
100%
;
height
:
100%
;
object-fit
:
cover
;
}
}
}
.right
{
i.iconfont
{
font-size
:
24px
;
}
}
}
</
style
>
\ No newline at end of file
src/components/tabbarPage.vue
View file @
402a60ed
...
...
@@ -18,6 +18,7 @@ import {
getUrlofQuery
}
from
"../utils/mayi.js"
;
import
{
serialize
,
DFSImg
}
from
"@/utils/index"
;
import
{
getStoreInfo
}
from
"@/utils/mayi.js"
;
const
app
=
getApp
();
const
{
log
}
=
app
;
...
...
@@ -42,15 +43,19 @@ export default {
},
computed
:
{
pageUrl
()
{
console
.
log
(
this
.
link
,
'******'
,
this
.
page
,
'-------'
,
this
.
params
,
'++++++++'
)
return
(
this
.
link
+
this
.
page
+
this
.
params
+
console
.
log
(
this
.
link
,
'******'
,
this
.
page
,
'-------'
,
this
.
params
,
'++++++++'
)
this
.
params
+=
`&native_test=1&tabbar=
${
this
.
index
}
&location_obj=
${
wx
.
getStorageSync
(
"location"
)}
`
+
this
.
ss
+
this
.
timestamp
)}
`
// url添加门店信息参数
let
{
offlineShopCode
,
offlineShopName
}
=
getStoreInfo
();
if
(
offlineShopCode
)
{
this
.
params
+=
`&offlineShopCode=
${
offlineShopCode
}
&offlineShopName=
${
offlineShopName
}
`
}
return
(
this
.
link
+
this
.
page
+
this
.
params
+
this
.
ss
+
this
.
timestamp
);
}
},
...
...
src/main.js
View file @
402a60ed
...
...
@@ -143,7 +143,7 @@ mpApp.DFSImg = DFSImg;
mpApp
.
concatUrl
=
concatUrl
;
mpApp
.
spokesmanApi
=
spokesmanApi
mpApp
.
getThemePage
=
getThemePage
//
mpApp.getThemePage = getThemePage
mpApp
.
themeColor
=
{}
mpApp
.
log
=
log
...
...
@@ -152,7 +152,6 @@ mpApp.tool = tool
function
getThemePage
({
mixid
,
shopid
})
{
shop
.
themePagesInfo
({
shopid
,
shopMixId
:
mixid
,
homePageFlag
:
true
})
...
...
src/pages/home/index.vue
View file @
402a60ed
<
template
>
<div
class=
"domain"
:style=
"
{'--main-color':themeColor['--main-color'],'--minor-color':themeColor['--minor-color']}">
<!--
<view
class=
"ant-daipinglun"
>
1
</view>
-->
<!--
<goods-list
id=
"goodsList"
></goods-list>
-->
<!--
<scroll-view
@
scroll=
"scrolls"
@
scrolltolower=
"scrolltolower"
style=
"height:100vh;overflow-y:auto;"
scroll-y=
"true"
>
-->
<div
style=
"position:relative;"
>
<div
v-if=
"showSpokesManHome"
>
<get-index-homepage
class=
"getIndexHomePage"
></get-index-homepage>
</div>
<ThemeDataPlant></ThemeDataPlant>
<StoreAddr></StoreAddr>
<div
v-for=
"(item,index) in pageData"
:key=
"index"
>
<div
v-if=
"item.componentCode=='banner' && item.componentInfo.visible == 1"
>
<banner
:datas=
"item"
></banner>
...
...
@@ -173,11 +171,12 @@ import memberInfo from "../../components/basicTool/member-info";
import
GoodsFliters
from
"../../components/common/GoodsFliters"
;
import
SelectGoods
from
"../../components/common/SelectGoods"
;
import
TwoBAddCart
from
"../../components/common/TwoBAddCart"
;
import
{
setTabBarActive
,
checkTabbarPage
,
themeColor
,
checkShowConditionIds
}
from
"../../utils/mayi.js"
;
import
{
setTabBarActive
,
checkTabbarPage
,
themeColor
,
checkShowConditionIds
,
setStoreInfo
}
from
"../../utils/mayi.js"
;
import
indexApi
from
"@/api/index.js"
;
import
{
throttle
,
concatUrl
}
from
"../../utils/index.js"
import
mpvueCropper
from
'@/components/mpvue-cropper'
import
tool
from
'../../utils/tool.js'
import
StoreAddr
from
"@/components/common/StoreAddr.vue"
;
const
app
=
getApp
();
const
{
log
}
=
app
;
export
default
{
...
...
@@ -219,8 +218,8 @@ export default {
shopPopup
,
bottomCont
,
ThemeDataPlant
,
'text-text'
:
text
,
'img-text'
:
imgText
,
"text-text"
:
text
,
"img-text"
:
imgText
,
coupon
,
integralTurntable
,
transverseLabel
,
...
...
@@ -232,14 +231,15 @@ export default {
birthPopup
,
mpvueCropper
,
woTimeout
,
'custom-list'
:
customList
,
'rich-text'
:
richText
,
'member-info'
:
memberInfo
,
"custom-list"
:
customList
,
"rich-text"
:
richText
,
"member-info"
:
memberInfo
,
GoodsFliters
,
SelectGoods
,
TwoBAddCart
,
brandList
},
brandList
,
StoreAddr
},
computed
:
{
applySucessEntryFlag
()
{
// 高意匠不展示
...
...
@@ -320,8 +320,18 @@ export default {
})
},
onLoad
(
options
)
{
console
.
log
(
new
Date
().
getTime
(),
'load-----home-onLoad'
)
console
.
log
(
options
,
'---------home----options'
)
log
.
info
(
options
,
'---------home----options'
)
log
.
info
(
options
,
'---------home----options'
)
let
h5Params
=
options
&&
options
.
params
?
JSON
.
parse
(
decodeURIComponent
(
options
.
params
))
:
""
;
console
.
log
(
h5Params
,
'--h5Params'
)
if
(
h5Params
)
{
// 存储h5url门店信息
setStoreInfo
({
offlineShopCode
:
h5Params
.
offlineShopCode
,
offlineShopName
:
h5Params
.
offlineShopName
,
});
}
//进页面存储需要绑定的信息
if
(
options
.
userId
||
options
.
spokesmanRelId
)
{
wx
.
setStorage
({
...
...
@@ -457,8 +467,10 @@ export default {
console
.
log
(
'storageGoodsList---detory'
);
},
onShow
()
{
onShow
(
options
)
{
console
.
log
(
new
Date
().
getTime
(),
'load-----home-onShow'
)
// 设置显示条件
console
.
log
(
new
Date
().
getTime
(),
'--------on--------------show'
)
log
.
info
(
'--------on--------------show'
)
//分销隔流
if
(
this
.
toHomePage
)
{
...
...
src/pages/index/index.vue
View file @
402a60ed
...
...
@@ -11,6 +11,7 @@ import shop from "@/api/shop.js";
import
indexApi
from
"@/api/index.js"
;
import
{
serialize
,
getQueryVariable
,
DFSImg
}
from
"@/utils/index"
;
import
login
from
"@/api/login"
;
import
{
getStoreInfo
}
from
"@/utils/mayi.js"
;
const
app
=
getApp
();
const
{
log
}
=
app
;
export
default
{
...
...
@@ -66,6 +67,11 @@ export default {
if
(
wx
.
getStorageSync
(
"enterpriseAccount"
)){
this
.
params
+=
`&enterpriseAccount=
${
wx
.
getStorageSync
(
"enterpriseAccount"
)}
`
;
}
// url添加门店信息参数
let
{
offlineShopCode
,
offlineShopName
}
=
getStoreInfo
();
if
(
offlineShopCode
)
{
this
.
params
+=
`&offlineShopCode=
${
offlineShopCode
}
&offlineShopName=
${
offlineShopName
}
`
}
console
.
log
(
this
.
link
,
'======='
,
this
.
page
,
'++++++++++++++'
,
this
.
params
,
'************'
)
let
pageUrl1
=
(
this
.
page
.
startsWith
(
'http://'
)
||
this
.
page
.
startsWith
(
'https://'
))?
(
this
.
page
+
this
.
params
)
:
this
.
link
+
this
.
page
+
this
.
params
console
.
log
(
pageUrl1
,
'--------pageUrl1--'
)
...
...
@@ -81,6 +87,7 @@ export default {
return
;
}
this
.
newPageUrl
=
this
.
pageUrl
;
console
.
log
(
'------------------index----2'
)
// 进入直播页面调用不息屏api
console
.
log
(
this
.
pageUrl
,
this
.
pageUrl
.
includes
(
'/liveBroadcast/lived'
),
"this.pageUrl.includes('/liveBroadcast/lived')"
)
if
(
this
.
pageUrl
.
includes
(
'/liveBroadcast/lived'
)){
...
...
@@ -139,7 +146,15 @@ export default {
this
.
options
=
options
;
log
.
info
(
this
.
options
,
'----------------index-----options'
)
Object
.
assign
(
this
.
$data
,
this
.
$options
.
data
());
let
h5Params
=
options
&&
options
.
params
?
JSON
.
parse
(
decodeURIComponent
(
options
.
params
))
:
""
;
console
.
log
(
h5Params
,
'--h5Params'
)
if
(
h5Params
)
{
// 存储h5url门店信息
setStoreInfo
({
offlineShopCode
:
h5Params
.
offlineShopCode
,
offlineShopName
:
h5Params
.
offlineShopName
,
});
}
if
(
wx
.
getStorageSync
(
"workBox"
)){
this
.
params
+=
`&workBox=
${
wx
.
getStorageSync
(
"workBox"
)}
`
}
...
...
@@ -429,7 +444,7 @@ export default {
// var query = options.query.dentistId; // 参数二维码传递过来的场景参数
}
this
.
newPageUrl
=
this
.
pageUrl
;
//
this.newPageUrl = this.pageUrl;
this
.
init
();
},
onShow
(){
...
...
src/pages/order/index.vue
View file @
402a60ed
...
...
@@ -9,6 +9,7 @@
<
script
type=
"text/ecmascript-6"
>
let
forUrlAddKey
=
require
(
"mayi-front-tools/forUrlAddKey"
).
default
;
import
{
serialize
,
getQueryVariable
,
DFSImg
}
from
"@/utils/index"
;
import
{
getStoreInfo
}
from
"@/utils/mayi.js"
;
const
app
=
getApp
();
const
{
log
}
=
app
;
export
default
{
...
...
@@ -32,6 +33,11 @@ export default {
if
(
wx
.
getStorageSync
(
"enterpriseAccount"
))
{
this
.
params
+=
`&enterpriseAccount=
${
wx
.
getStorageSync
(
"enterpriseAccount"
)}
`
;
}
// url添加门店信息参数
let
{
offlineShopCode
,
offlineShopName
}
=
getStoreInfo
();
if
(
offlineShopCode
)
{
this
.
params
+=
`&offlineShopCode=
${
offlineShopCode
}
&offlineShopName=
${
offlineShopName
}
`
}
console
.
log
(
this
.
baseUrl
,
'======='
,
this
.
page
,
'++++++++++++++'
,
this
.
params
,
'************'
)
let
pageUrl1
=
(
this
.
page
.
startsWith
(
'http://'
)
||
this
.
page
.
startsWith
(
'https://'
))
?
(
this
.
page
+
this
.
params
)
:
this
.
baseUrl
+
this
.
page
+
this
.
params
console
.
log
(
pageUrl1
,
'--------pageUrl1--'
)
...
...
src/store/mutations.js
View file @
402a60ed
...
...
@@ -10,9 +10,6 @@ const mutations = {
setSubscribeMessageObj
(
state
,
subscribeMessageObj
)
{
state
.
subscribeMessageObj
=
subscribeMessageObj
;
},
setOfflineShopCode
(
state
,
code
)
{
state
.
offlineShopCode
=
code
;
},
//设置登录状态
setLoginStatus
(
state
,
val
){
...
...
src/store/state.js
View file @
402a60ed
...
...
@@ -17,7 +17,6 @@ const state = {
spokesmanRelId
:
""
,
userId
:
""
,
subscribeMessageObj
:
{},
offlineShopCode
:
""
,
isLogin
,
userInfo
,
shopUserInfo
:
{},
...
...
src/utils/mayi.js
View file @
402a60ed
This diff is collapsed.
Click to expand it.
src/utils/request.js
View file @
402a60ed
...
...
@@ -13,7 +13,7 @@ export async function requestGET(url, options) {
method
:
"GET"
,
header
:
{
"Shop-Mixid"
:
store
.
state
.
mixid
,
"Offline-Shop-Code"
:
store
.
state
.
offlineShopCode
,
"Offline-Shop-Code"
:
wx
.
getStorageSync
(
'offlineShopCode'
)
||
""
,
"Authorization"
:
wx
.
getStorageSync
(
'sessionid'
)
||
""
,
"Region-id"
:
wx
.
getStorageSync
(
'location'
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
'location'
)).
systemRegionId
:
''
,
"Area-Id"
:
wx
.
getStorageSync
(
'location'
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
'location'
)).
id
:
''
,
...
...
@@ -38,7 +38,7 @@ export async function requestPOST(url, options) {
header
:
{
"Shop-Mixid"
:
store
.
state
.
mixid
,
"Authorization"
:
wx
.
getStorageSync
(
'sessionid'
)
||
""
,
"Offline-Shop-Code"
:
store
.
state
.
offlineShopCode
,
"Offline-Shop-Code"
:
wx
.
getStorageSync
(
'offlineShopCode'
)
||
""
,
"openId"
:
wx
.
getStorageSync
(
"openid"
)
||
''
,
"Region-id"
:
wx
.
getStorageSync
(
'location'
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
'location'
)).
systemRegionId
:
''
,
"Area-Id"
:
wx
.
getStorageSync
(
'location'
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
'location'
)).
id
:
''
,
...
...
@@ -64,7 +64,7 @@ export function requestPOST1(url, options) {
"Content-Type"
:
"application/x-www-form-urlencoded"
,
"Shop-Mixid"
:
store
.
state
.
mixid
,
Authorization
:
wx
.
getStorageSync
(
'sessionid'
)
||
""
,
"Offline-Shop-Code"
:
store
.
state
.
offlineShopCode
,
"Offline-Shop-Code"
:
wx
.
getStorageSync
(
'offlineShopCode'
)
||
""
,
"Region-id"
:
wx
.
getStorageSync
(
'location'
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
'location'
)).
systemRegionId
:
''
,
"Area-Id"
:
wx
.
getStorageSync
(
'location'
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
'location'
)).
id
:
''
,
// "dubbo-tag": "ljx"
...
...
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