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
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
494 additions
and
174 deletions
+494
-174
src/api/shop.js
+20
-16
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
+239
-127
src/utils/request.js
+3
-3
No files found.
src/api/shop.js
View file @
402a60ed
import
{
requestPOST
,
requestPOST1
}
from
"@/utils/request.js"
;
import
{
requestPOST
,
requestPOST1
}
from
"@/utils/request.js"
;
export
default
{
export
default
{
getShopInfo
()
{
getShopInfo
()
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/shop/get_shop_info`
);
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/shop/get_shop_info`
);
...
@@ -12,14 +11,13 @@ export default {
...
@@ -12,14 +11,13 @@ export default {
},
},
addWxMiniSubscribeMessageRecord
(
data
)
{
addWxMiniSubscribeMessageRecord
(
data
)
{
return
requestPOST
(
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/shop/addWxMiniSubscribeMessageRecord`
,
data
`
${
process
.
env
.
OLSHOP_URL
}
/shop/addWxMiniSubscribeMessageRecord`
,
data
);
);
},
},
// 页面数据
// 页面数据
themePagesInfo
(
params
)
{
themePagesInfo
(
params
)
{
return
requestPOST
(
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/cms/get_shop_install_pages?homePageFlag=
${
params
.
homePageFlag
||
false
}
&shopMixId=
${
params
.
shopMixId
}
`
,
`
${
process
.
env
.
OLSHOP_URL
}
/cms/get_shop_install_pages?homePageFlag=
${
params
.
homePageFlag
||
false
}
`
,
params
);
);
},
},
checkShowCondition
(
params
)
{
checkShowCondition
(
params
)
{
...
@@ -30,12 +28,9 @@ export default {
...
@@ -30,12 +28,9 @@ export default {
},
},
// 获取新版会员卡列表
// 获取新版会员卡列表
getV3CardList
(
params
)
{
getV3CardList
(
params
)
{
return
requestPOST
(
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/user/membership_card_list`
,
{
`
${
process
.
env
.
OLSHOP_URL
}
/user/membership_card_list`
,
{
params
params
}
});
);
},
},
// 领取新版无门槛会员卡
// 领取新版无门槛会员卡
drawV3Card
(
params
)
{
drawV3Card
(
params
)
{
...
@@ -45,13 +40,22 @@ export default {
...
@@ -45,13 +40,22 @@ export default {
},
},
//获取shop配置
//获取shop配置
get_shop_configuration
(){
get_shop_configuration
()
{
return
requestPOST
(
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/shop/get_shop_configuration`
);
`
${
process
.
env
.
OLSHOP_URL
}
/shop/get_shop_configuration`
);
},
},
// 获取系统配置
// 获取系统配置
get_system_config_by_code
(
params
)
{
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 {
...
@@ -18,6 +18,7 @@ import {
getUrlofQuery
getUrlofQuery
}
from
"../utils/mayi.js"
;
}
from
"../utils/mayi.js"
;
import
{
serialize
,
DFSImg
}
from
"@/utils/index"
;
import
{
serialize
,
DFSImg
}
from
"@/utils/index"
;
import
{
getStoreInfo
}
from
"@/utils/mayi.js"
;
const
app
=
getApp
();
const
app
=
getApp
();
const
{
log
}
=
app
;
const
{
log
}
=
app
;
...
@@ -42,15 +43,19 @@ export default {
...
@@ -42,15 +43,19 @@ export default {
},
},
computed
:
{
computed
:
{
pageUrl
()
{
pageUrl
()
{
console
.
log
(
this
.
link
,
'******'
,
this
.
page
,
'-------'
,
this
.
params
,
'++++++++'
)
console
.
log
(
this
.
link
,
'******'
,
this
.
page
,
'-------'
,
this
.
params
,
'++++++++'
)
return
(
this
.
params
+=
this
.
link
+
this
.
page
+
this
.
params
+
`&native_test=1&tabbar=
${
this
.
index
}
&location_obj=
${
wx
.
getStorageSync
(
`&native_test=1&tabbar=
${
this
.
index
}
&location_obj=
${
wx
.
getStorageSync
(
"location"
"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;
...
@@ -143,7 +143,7 @@ mpApp.DFSImg = DFSImg;
mpApp
.
concatUrl
=
concatUrl
;
mpApp
.
concatUrl
=
concatUrl
;
mpApp
.
spokesmanApi
=
spokesmanApi
mpApp
.
spokesmanApi
=
spokesmanApi
mpApp
.
getThemePage
=
getThemePage
//
mpApp.getThemePage = getThemePage
mpApp
.
themeColor
=
{}
mpApp
.
themeColor
=
{}
mpApp
.
log
=
log
mpApp
.
log
=
log
...
@@ -152,7 +152,6 @@ mpApp.tool = tool
...
@@ -152,7 +152,6 @@ mpApp.tool = tool
function
getThemePage
({
mixid
,
shopid
})
{
function
getThemePage
({
mixid
,
shopid
})
{
shop
shop
.
themePagesInfo
({
.
themePagesInfo
({
shopid
,
shopMixId
:
mixid
,
shopMixId
:
mixid
,
homePageFlag
:
true
homePageFlag
:
true
})
})
...
...
src/pages/home/index.vue
View file @
402a60ed
<
template
>
<
template
>
<div
class=
"domain"
:style=
"
{'--main-color':themeColor['--main-color'],'--minor-color':themeColor['--minor-color']}">
<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
style=
"position:relative;"
>
<div
v-if=
"showSpokesManHome"
>
<div
v-if=
"showSpokesManHome"
>
<get-index-homepage
class=
"getIndexHomePage"
></get-index-homepage>
<get-index-homepage
class=
"getIndexHomePage"
></get-index-homepage>
</div>
</div>
<ThemeDataPlant></ThemeDataPlant>
<ThemeDataPlant></ThemeDataPlant>
<StoreAddr></StoreAddr>
<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>
...
@@ -173,11 +171,12 @@ import memberInfo from "../../components/basicTool/member-info";
...
@@ -173,11 +171,12 @@ import memberInfo from "../../components/basicTool/member-info";
import
GoodsFliters
from
"../../components/common/GoodsFliters"
;
import
GoodsFliters
from
"../../components/common/GoodsFliters"
;
import
SelectGoods
from
"../../components/common/SelectGoods"
;
import
SelectGoods
from
"../../components/common/SelectGoods"
;
import
TwoBAddCart
from
"../../components/common/TwoBAddCart"
;
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
indexApi
from
"@/api/index.js"
;
import
{
throttle
,
concatUrl
}
from
"../../utils/index.js"
import
{
throttle
,
concatUrl
}
from
"../../utils/index.js"
import
mpvueCropper
from
'@/components/mpvue-cropper'
import
mpvueCropper
from
'@/components/mpvue-cropper'
import
tool
from
'../../utils/tool.js'
import
tool
from
'../../utils/tool.js'
import
StoreAddr
from
"@/components/common/StoreAddr.vue"
;
const
app
=
getApp
();
const
app
=
getApp
();
const
{
log
}
=
app
;
const
{
log
}
=
app
;
export
default
{
export
default
{
...
@@ -219,8 +218,8 @@ export default {
...
@@ -219,8 +218,8 @@ export default {
shopPopup
,
shopPopup
,
bottomCont
,
bottomCont
,
ThemeDataPlant
,
ThemeDataPlant
,
'text-text'
:
text
,
"text-text"
:
text
,
'img-text'
:
imgText
,
"img-text"
:
imgText
,
coupon
,
coupon
,
integralTurntable
,
integralTurntable
,
transverseLabel
,
transverseLabel
,
...
@@ -232,14 +231,15 @@ export default {
...
@@ -232,14 +231,15 @@ export default {
birthPopup
,
birthPopup
,
mpvueCropper
,
mpvueCropper
,
woTimeout
,
woTimeout
,
'custom-list'
:
customList
,
"custom-list"
:
customList
,
'rich-text'
:
richText
,
"rich-text"
:
richText
,
'member-info'
:
memberInfo
,
"member-info"
:
memberInfo
,
GoodsFliters
,
GoodsFliters
,
SelectGoods
,
SelectGoods
,
TwoBAddCart
,
TwoBAddCart
,
brandList
brandList
,
},
StoreAddr
},
computed
:
{
computed
:
{
applySucessEntryFlag
()
{
applySucessEntryFlag
()
{
// 高意匠不展示
// 高意匠不展示
...
@@ -320,8 +320,18 @@ export default {
...
@@ -320,8 +320,18 @@ export default {
})
})
},
},
onLoad
(
options
)
{
onLoad
(
options
)
{
console
.
log
(
new
Date
().
getTime
(),
'load-----home-onLoad'
)
console
.
log
(
options
,
'---------home----options'
)
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
)
{
if
(
options
.
userId
||
options
.
spokesmanRelId
)
{
wx
.
setStorage
({
wx
.
setStorage
({
...
@@ -457,8 +467,10 @@ export default {
...
@@ -457,8 +467,10 @@ export default {
console
.
log
(
'storageGoodsList---detory'
);
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'
)
log
.
info
(
'--------on--------------show'
)
//分销隔流
//分销隔流
if
(
this
.
toHomePage
)
{
if
(
this
.
toHomePage
)
{
...
...
src/pages/index/index.vue
View file @
402a60ed
...
@@ -11,6 +11,7 @@ import shop from "@/api/shop.js";
...
@@ -11,6 +11,7 @@ import shop from "@/api/shop.js";
import
indexApi
from
"@/api/index.js"
;
import
indexApi
from
"@/api/index.js"
;
import
{
serialize
,
getQueryVariable
,
DFSImg
}
from
"@/utils/index"
;
import
{
serialize
,
getQueryVariable
,
DFSImg
}
from
"@/utils/index"
;
import
login
from
"@/api/login"
;
import
login
from
"@/api/login"
;
import
{
getStoreInfo
}
from
"@/utils/mayi.js"
;
const
app
=
getApp
();
const
app
=
getApp
();
const
{
log
}
=
app
;
const
{
log
}
=
app
;
export
default
{
export
default
{
...
@@ -66,6 +67,11 @@ export default {
...
@@ -66,6 +67,11 @@ export default {
if
(
wx
.
getStorageSync
(
"enterpriseAccount"
)){
if
(
wx
.
getStorageSync
(
"enterpriseAccount"
)){
this
.
params
+=
`&enterpriseAccount=
${
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
,
'************'
)
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
let
pageUrl1
=
(
this
.
page
.
startsWith
(
'http://'
)
||
this
.
page
.
startsWith
(
'https://'
))?
(
this
.
page
+
this
.
params
)
:
this
.
link
+
this
.
page
+
this
.
params
console
.
log
(
pageUrl1
,
'--------pageUrl1--'
)
console
.
log
(
pageUrl1
,
'--------pageUrl1--'
)
...
@@ -81,6 +87,7 @@ export default {
...
@@ -81,6 +87,7 @@ export default {
return
;
return
;
}
}
this
.
newPageUrl
=
this
.
pageUrl
;
this
.
newPageUrl
=
this
.
pageUrl
;
console
.
log
(
'------------------index----2'
)
// 进入直播页面调用不息屏api
// 进入直播页面调用不息屏api
console
.
log
(
this
.
pageUrl
,
this
.
pageUrl
.
includes
(
'/liveBroadcast/lived'
),
"this.pageUrl.includes('/liveBroadcast/lived')"
)
console
.
log
(
this
.
pageUrl
,
this
.
pageUrl
.
includes
(
'/liveBroadcast/lived'
),
"this.pageUrl.includes('/liveBroadcast/lived')"
)
if
(
this
.
pageUrl
.
includes
(
'/liveBroadcast/lived'
)){
if
(
this
.
pageUrl
.
includes
(
'/liveBroadcast/lived'
)){
...
@@ -139,7 +146,15 @@ export default {
...
@@ -139,7 +146,15 @@ export default {
this
.
options
=
options
;
this
.
options
=
options
;
log
.
info
(
this
.
options
,
'----------------index-----options'
)
log
.
info
(
this
.
options
,
'----------------index-----options'
)
Object
.
assign
(
this
.
$data
,
this
.
$options
.
data
());
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"
)){
if
(
wx
.
getStorageSync
(
"workBox"
)){
this
.
params
+=
`&workBox=
${
wx
.
getStorageSync
(
"workBox"
)}
`
this
.
params
+=
`&workBox=
${
wx
.
getStorageSync
(
"workBox"
)}
`
}
}
...
@@ -429,7 +444,7 @@ export default {
...
@@ -429,7 +444,7 @@ export default {
// var query = options.query.dentistId; // 参数二维码传递过来的场景参数
// var query = options.query.dentistId; // 参数二维码传递过来的场景参数
}
}
this
.
newPageUrl
=
this
.
pageUrl
;
//
this.newPageUrl = this.pageUrl;
this
.
init
();
this
.
init
();
},
},
onShow
(){
onShow
(){
...
...
src/pages/order/index.vue
View file @
402a60ed
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
<
script
type=
"text/ecmascript-6"
>
<
script
type=
"text/ecmascript-6"
>
let
forUrlAddKey
=
require
(
"mayi-front-tools/forUrlAddKey"
).
default
;
let
forUrlAddKey
=
require
(
"mayi-front-tools/forUrlAddKey"
).
default
;
import
{
serialize
,
getQueryVariable
,
DFSImg
}
from
"@/utils/index"
;
import
{
serialize
,
getQueryVariable
,
DFSImg
}
from
"@/utils/index"
;
import
{
getStoreInfo
}
from
"@/utils/mayi.js"
;
const
app
=
getApp
();
const
app
=
getApp
();
const
{
log
}
=
app
;
const
{
log
}
=
app
;
export
default
{
export
default
{
...
@@ -32,6 +33,11 @@ export default {
...
@@ -32,6 +33,11 @@ export default {
if
(
wx
.
getStorageSync
(
"enterpriseAccount"
))
{
if
(
wx
.
getStorageSync
(
"enterpriseAccount"
))
{
this
.
params
+=
`&enterpriseAccount=
${
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
,
'************'
)
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
let
pageUrl1
=
(
this
.
page
.
startsWith
(
'http://'
)
||
this
.
page
.
startsWith
(
'https://'
))
?
(
this
.
page
+
this
.
params
)
:
this
.
baseUrl
+
this
.
page
+
this
.
params
console
.
log
(
pageUrl1
,
'--------pageUrl1--'
)
console
.
log
(
pageUrl1
,
'--------pageUrl1--'
)
...
...
src/store/mutations.js
View file @
402a60ed
...
@@ -10,9 +10,6 @@ const mutations = {
...
@@ -10,9 +10,6 @@ const mutations = {
setSubscribeMessageObj
(
state
,
subscribeMessageObj
)
{
setSubscribeMessageObj
(
state
,
subscribeMessageObj
)
{
state
.
subscribeMessageObj
=
subscribeMessageObj
;
state
.
subscribeMessageObj
=
subscribeMessageObj
;
},
},
setOfflineShopCode
(
state
,
code
)
{
state
.
offlineShopCode
=
code
;
},
//设置登录状态
//设置登录状态
setLoginStatus
(
state
,
val
){
setLoginStatus
(
state
,
val
){
...
...
src/store/state.js
View file @
402a60ed
...
@@ -17,7 +17,6 @@ const state = {
...
@@ -17,7 +17,6 @@ const state = {
spokesmanRelId
:
""
,
spokesmanRelId
:
""
,
userId
:
""
,
userId
:
""
,
subscribeMessageObj
:
{},
subscribeMessageObj
:
{},
offlineShopCode
:
""
,
isLogin
,
isLogin
,
userInfo
,
userInfo
,
shopUserInfo
:
{},
shopUserInfo
:
{},
...
...
src/utils/mayi.js
View file @
402a60ed
import
cart
from
"@/api/cart"
import
cart
from
"@/api/cart"
;
import
shop
from
"@/api/shop"
import
shop
from
"@/api/shop"
;
import
coupon
from
"@/api/coupon"
;
import
coupon
from
"@/api/coupon"
;
import
goods
from
'@/api/goods'
;
import
goods
from
"@/api/goods"
;
import
classificationApi
from
"@/api/classification"
;
import
classificationApi
from
"@/api/classification"
;
// 登录白名单 name
// 登录白名单 name
export
const
noLoginList
=
[
"index"
,
"media-video"
,
"goods-goodsInfo"
,
"goods-commodityMenu"
,
"goodsSearch-goodsSearch"
,
"contentSearch-contentSearch"
,
"chooseStores"
,
"activty-receivingGift"
,
"activty"
,
"login-register"
,
"login-phoneLogin"
,
"login-authInformation"
,
"login-forgetPassWord"
,
"login-accountLogin"
,
"login-wxRegister"
,
"pay-payList"
,
"comment-evaluateList"
,
"goods-commonProblemList"
,
"article-articlePage"
,
"article-articleList"
,
"goods-posters"
,
"liveBroadcast"
,
"liveBroadcast-list"
,
"personalCenter-coupon-getCoupon"
,
"buyerShow-showDetail"
,
"goods-addGoodsList"
,
"personalCenter-CDkey-exchange"
,
"giftCards-linkReceive"
,
"giftCoupon-preview"
,
"smartForm"
,
"shopCart-shareShopCart"
,
"groupBuying-beInvite"
,
"brandTopics"
,
"personalCenter-spokesmanCenter"
,
"personalCenter-spokesmanCenter-mine-spokesmanHomePage"
,
"liveBroadcast-lived"
,
"personalCenter-spokesmanCenter-mine-getBusinessCard"
,
"changeAdr"
];
export
const
noLoginList
=
[
"index"
,
"media-video"
,
"goods-goodsInfo"
,
"goods-commodityMenu"
,
"goodsSearch-goodsSearch"
,
"contentSearch-contentSearch"
,
"chooseStores"
,
"activty-receivingGift"
,
"activty"
,
"login-register"
,
"login-phoneLogin"
,
"login-authInformation"
,
"login-forgetPassWord"
,
"login-accountLogin"
,
"login-wxRegister"
,
"pay-payList"
,
"comment-evaluateList"
,
"goods-commonProblemList"
,
"article-articlePage"
,
"article-articleList"
,
"goods-posters"
,
"liveBroadcast"
,
"liveBroadcast-list"
,
"personalCenter-coupon-getCoupon"
,
"buyerShow-showDetail"
,
"goods-addGoodsList"
,
"personalCenter-CDkey-exchange"
,
"giftCards-linkReceive"
,
"giftCoupon-preview"
,
"smartForm"
,
"shopCart-shareShopCart"
,
"groupBuying-beInvite"
,
"brandTopics"
,
"personalCenter-spokesmanCenter"
,
"personalCenter-spokesmanCenter-mine-spokesmanHomePage"
,
"liveBroadcast-lived"
,
"personalCenter-spokesmanCenter-mine-getBusinessCard"
,
"changeAdr"
];
// path
// path
export
const
noLoginListPath
=
noLoginList
.
map
(
item
=>
{
export
const
noLoginListPath
=
noLoginList
.
map
(
item
=>
{
item
=
item
.
replace
(
/-/g
,
'/'
)
item
=
item
.
replace
(
/-/g
,
"/"
);
item
=
'/'
+
item
item
=
"/"
+
item
;
item
==
"/index"
&&
(
item
=
"/"
)
item
==
"/index"
&&
(
item
=
"/"
);
return
item
return
item
;
})
})
;
// 有底部栏页面
// 有底部栏页面
export
const
containFooterPage
=
[
"/"
,
"/goods/commodityMenu"
,
"/shopCart/shoppingCart"
,
"/personalCenter"
]
export
const
containFooterPage
=
[
"/"
,
"/goods/commodityMenu"
,
"/shopCart/shoppingCart"
,
"/personalCenter"
];
// 主题色
// 主题色
export
let
themeColor
=
{
export
let
themeColor
=
{
"--main-color"
:
"#ffffff"
,
"--main-color"
:
"#ffffff"
,
"--minor-color"
:
"#ffffff"
"--minor-color"
:
"#ffffff"
}
}
;
// 获取link 中页面地址(link兼容 有object或者string)
// 获取link 中页面地址(link兼容 有object或者string)
export
function
getUrlofLink
(
data
)
{
export
function
getUrlofLink
(
data
)
{
if
(
typeof
data
==
"object"
&&
data
.
link
)
{
if
(
typeof
data
==
'object'
&&
data
.
link
){
return
data
.
link
.
split
(
"?"
)[
0
];
return
data
.
link
.
split
(
'?'
)[
0
]
}
}
if
(
typeof
data
==
'string'
)
{
if
(
typeof
data
==
"string"
)
{
return
data
.
split
(
'?'
)[
0
]
return
data
.
split
(
"?"
)[
0
];
}
}
}
}
export
function
getUrlofQuery
(
data
)
{
export
function
getUrlofQuery
(
data
)
{
return
data
.
link
.
split
(
'?'
)[
1
]
||
''
return
data
.
link
.
split
(
"?"
)[
1
]
||
""
;
}
}
// 全局跳转 data:link数据 option:是否为底部栏触发
// 全局跳转 data:link数据 option:是否为底部栏触发
export
function
$themeToLink
(
data
,
option
)
{
export
function
$themeToLink
(
data
,
option
)
{
// console.log(currentPage,'currentPage',getUrlofLink(data))
// console.log(currentPage,'currentPage',getUrlofLink(data))
// if(getUrlofLink(data).includes(currentPage)) return
// if(getUrlofLink(data).includes(currentPage)) return
...
@@ -48,11 +90,14 @@ export function $themeToLink(data, option) {
...
@@ -48,11 +90,14 @@ export function $themeToLink(data, option) {
let
parseLink
=
getUrlofLink
(
data
);
let
parseLink
=
getUrlofLink
(
data
);
let
parseQuery
=
getUrlofQuery
(
data
);
let
parseQuery
=
getUrlofQuery
(
data
);
let
noLogin
=
noLoginListPath
.
includes
(
parseLink
)
||
parseLink
.
substr
(
0
,
7
)
==
"/goods/"
||
parseLink
.
includes
(
'/brandTopics'
);
let
noLogin
=
noLoginListPath
.
includes
(
parseLink
)
||
parseLink
.
substr
(
0
,
7
)
==
"/goods/"
||
parseLink
.
includes
(
"/brandTopics"
);
if
(
!
noLogin
&&
!
wx
.
getStorageSync
(
"sessionid"
))
{
if
(
!
noLogin
&&
!
wx
.
getStorageSync
(
"sessionid"
))
{
let
url
=
`/pages/login/main?back=
${
parseLink
}
`
;
let
url
=
`/pages/login/main?back=
${
parseLink
}
`
;
wx
.
navigateTo
({
url
});
wx
.
navigateTo
({
url
});
return
return
;
}
}
//判断是否市跳转到tabbar页面 替换首页位置
//判断是否市跳转到tabbar页面 替换首页位置
let
isTabbarIndex
=
checkTabbarPage
(
parseLink
);
let
isTabbarIndex
=
checkTabbarPage
(
parseLink
);
...
@@ -63,77 +108,97 @@ export function $themeToLink(data, option) {
...
@@ -63,77 +108,97 @@ export function $themeToLink(data, option) {
// return
// return
// }
// }
isTabbarIndex
=
isTabbarIndex
==
0
?
checkTabbarPage
(
"/"
)
:
isTabbarIndex
;
isTabbarIndex
=
isTabbarIndex
==
0
?
checkTabbarPage
(
'/'
)
:
isTabbarIndex
;
let
url
=
let
url
=
parseLink
==
'/'
?
`/pages/home/main`
:
`/pages/tabBar
${
isTabbarIndex
}
/main`
;
parseLink
==
"/"
?
`/pages/home/main`
:
`/pages/tabBar
${
isTabbarIndex
}
/main`
;
let
routes
=
getCurrentPages
();
let
routes
=
getCurrentPages
();
let
currentPage
=
routes
[
routes
.
length
-
1
].
route
;
let
currentPage
=
routes
[
routes
.
length
-
1
].
route
;
if
(
currentPage
==
url
)
return
if
(
currentPage
==
url
)
return
;
let
query
=
parseQuery
?
`?
${
parseQuery
}
`
:
''
;
let
query
=
parseQuery
?
`?
${
parseQuery
}
`
:
""
;
wx
.
reLaunch
({
wx
.
reLaunch
({
url
:
url
+
query
url
:
url
+
query
})
});
return
return
;
}
}
}
}
// 历史数据
// 历史数据
if
(
type
==
undefined
||
type
==
'undefined'
)
{
if
(
type
==
undefined
||
type
==
"undefined"
)
{
if
(
data
.
length
>
0
)
{
if
(
data
.
length
>
0
)
{
toPage
(
getUrlofLink
(
data
),
getUrlofQuery
(
data
))
toPage
(
getUrlofLink
(
data
),
getUrlofQuery
(
data
));
}
}
return
return
;
}
}
// -----------------
// -----------------
if
(
type
==
0
)
{
//无链接
if
(
type
==
0
)
{
return
//无链接
}
else
if
(
type
==
1
)
{
//h5页面
return
;
}
else
if
(
type
==
1
)
{
//h5页面
//兼容
//兼容
if
(
data
.
link
.
substring
(
0
,
1
)
==
"/"
)
{
if
(
data
.
link
.
substring
(
0
,
1
)
==
"/"
)
{
toPage
(
getUrlofLink
(
data
),
getUrlofQuery
(
data
))
toPage
(
getUrlofLink
(
data
),
getUrlofQuery
(
data
));
}
else
{
}
else
{
if
(
data
.
link
.
startsWith
(
'http'
)
||
data
.
link
.
startsWith
(
'https'
))
{
if
(
data
.
link
.
startsWith
(
"http"
)
||
data
.
link
.
startsWith
(
"https"
))
{
wx
.
navigateTo
({
url
:
'/pages/wxArticle/main?link='
+
encodeURIComponent
(
data
.
link
)
});
wx
.
navigateTo
({
url
:
"/pages/wxArticle/main?link="
+
encodeURIComponent
(
data
.
link
)
});
}
}
}
}
}
else
if
(
type
==
1.1
)
{
//小程序页面 可能增加登录态拦截
}
else
if
(
type
==
1.1
)
{
//小程序页面 可能增加登录态拦截
wx
.
navigateTo
({
url
:
data
.
link
});
wx
.
navigateTo
({
url
:
data
.
link
});
}
else
if
(
type
==
1.2
)
{
//第三方链接
}
else
if
(
type
==
1.2
)
{
if
(
data
.
link
==
'outerChain:businessCenter'
)
{
//第三方链接
if
(
data
.
link
==
"outerChain:businessCenter"
)
{
// 进入商家中心外链
// 进入商家中心外链
let
url
=
`
${
config
.
GUIDE_URL
}
/login?mixid=
${
this
.
$nuxt
.
$route
.
query
.
mixid
}
&back=
${
encodeURIComponent
(
window
.
location
.
href
)}
`
;
let
url
=
`
${
config
.
GUIDE_URL
}
/login?mixid=
${
wx
.
navigateTo
({
url
:
'/pages/wxArticle/main?link='
+
encodeURIComponent
(
url
)
});
this
.
$nuxt
.
$route
.
query
.
mixid
return
}
&back=
${
encodeURIComponent
(
window
.
location
.
href
)}
`
;
wx
.
navigateTo
({
url
:
"/pages/wxArticle/main?link="
+
encodeURIComponent
(
url
)
});
return
;
}
}
if
(
data
.
link
.
substring
(
0
,
1
)
==
"/"
)
{
if
(
data
.
link
.
substring
(
0
,
1
)
==
"/"
)
{
toPage
(
getUrlofLink
(
data
),
getUrlofQuery
(
data
))
toPage
(
getUrlofLink
(
data
),
getUrlofQuery
(
data
));
}
else
{
}
else
{
wx
.
navigateTo
({
url
:
'/pages/wxArticle/main?link='
+
encodeURIComponent
(
data
.
link
)
});
wx
.
navigateTo
({
url
:
"/pages/wxArticle/main?link="
+
encodeURIComponent
(
data
.
link
)
});
}
}
}
else
if
(
type
==
2
)
{
//功能
}
else
if
(
type
==
2
)
{
//功能
let
featureType
=
data
.
feature
.
type
;
let
featureType
=
data
.
feature
.
type
;
if
(
featureType
==
'themeCouponClick'
||
featureType
==
0
)
{
//优惠券
if
(
featureType
==
"themeCouponClick"
||
featureType
==
0
)
{
//优惠券
// this.$themeCouponClick(data.feature.value.couponCode, data.feature.value);
// this.$themeCouponClick(data.feature.value.couponCode, data.feature.value);
}
else
if
(
featureType
==
1
)
{
//分享
}
else
if
(
featureType
==
1
)
{
console
.
log
(
'是分享了。。。。'
);
//分享
console
.
log
(
"是分享了。。。。"
);
app
.
shareInit
({
itemList
:
data
.
feature
.
value
});
app
.
shareInit
({
itemList
:
data
.
feature
.
value
});
}
else
if
(
featureType
==
"themeMemberCardClick"
||
featureType
==
2
)
{
//会员卡
}
else
if
(
featureType
==
"themeMemberCardClick"
||
featureType
==
2
)
{
//会员卡
// this.$themeMemberCardClick(data.feature.value);
// this.$themeMemberCardClick(data.feature.value);
}
}
}
else
if
(
type
==
3
)
{
//小程序跳转到小程序
}
else
if
(
type
==
3
)
{
//小程序跳转到小程序
wx
.
navigateTo
({
wx
.
navigateTo
({
url
:
`/pages/toMini/main?weappPage=
${
encodeURIComponent
(
data
.
link
)}
&weappAppId=
${
data
.
name
}
`
,
url
:
`/pages/toMini/main?weappPage=
${
encodeURIComponent
(
})
data
.
link
)}
&weappAppId=
${
data
.
name
}
`
});
}
else
{
}
else
{
//向后兼容
//向后兼容
if
(
data
.
length
>
0
)
{
if
(
data
.
length
>
0
)
{
toPage
(
getUrlofLink
(
data
),
getUrlofQuery
(
data
))
toPage
(
getUrlofLink
(
data
),
getUrlofQuery
(
data
));
}
}
}
}
}
}
export
function
$themeAddToCard
(
item
,
callback
=
()
=>
{
})
{
export
function
$themeAddToCard
(
item
,
callback
=
()
=>
{})
{
let
errorMsg
=
""
;
let
errorMsg
=
""
;
if
(
item
.
productNature
==
5
)
{
if
(
item
.
productNature
==
5
)
{
errorMsg
=
"电子卡券不可加入购物车"
;
errorMsg
=
"电子卡券不可加入购物车"
;
...
@@ -147,7 +212,7 @@ export function $themeAddToCard(item, callback = () => { }) {
...
@@ -147,7 +212,7 @@ export function $themeAddToCard(item, callback = () => { }) {
if
(
errorMsg
)
{
if
(
errorMsg
)
{
wx
.
showToast
({
wx
.
showToast
({
title
:
errorMsg
,
title
:
errorMsg
,
icon
:
'none'
,
icon
:
"none"
});
});
}
}
cart
cart
...
@@ -163,64 +228,70 @@ export function $themeAddToCard(item, callback = () => { }) {
...
@@ -163,64 +228,70 @@ export function $themeAddToCard(item, callback = () => { }) {
}
}
function
toPage
(
backPath
,
backParams
=
""
)
{
function
toPage
(
backPath
,
backParams
=
""
)
{
console
.
log
(
backPath
,
backParams
,
'--------------------------159'
);
console
.
log
(
backPath
,
backParams
,
"--------------------------159"
);
wx
.
navigateTo
({
wx
.
navigateTo
({
url
:
`../index/main?from=themeLink&backpath=
${
encodeURIComponent
(
backPath
)}
¶ms=
${
encodeURIComponent
(
backParams
)}
`
url
:
`../index/main?from=themeLink&backpath=
${
encodeURIComponent
(
backPath
)}
¶ms=
${
encodeURIComponent
(
backParams
)}
`
});
});
}
}
// check 链接是否为底部导航栏页面 返回索引
// check 链接是否为底部导航栏页面 返回索引
export
function
checkTabbarPage
(
link
)
{
export
function
checkTabbarPage
(
link
)
{
let
app
=
getApp
()
let
app
=
getApp
();
if
(
!
app
.
globalData
.
footerVal
)
return
-
1
if
(
!
app
.
globalData
.
footerVal
)
return
-
1
;
let
footerVal
=
app
.
globalData
.
footerVal
.
componentData
.
list
;
let
footerVal
=
app
.
globalData
.
footerVal
.
componentData
.
list
;
let
isFooter
=
footerVal
.
findIndex
(
item
=>
{
let
isFooter
=
footerVal
.
findIndex
(
item
=>
{
return
getUrlofLink
(
item
.
link
)
==
link
.
split
(
'?'
)[
0
]
return
getUrlofLink
(
item
.
link
)
==
link
.
split
(
"?"
)[
0
];
})
});
return
isFooter
return
isFooter
;
}
}
// 当前底部栏选中项
// 当前底部栏选中项
export
function
setTabBarActive
(
data
)
{
export
function
setTabBarActive
(
data
)
{
// console.log(data,'sssssssssss',this.$mp.page.getTabBar(),data)
// console.log(data,'sssssssssss',this.$mp.page.getTabBar(),data)
if
(
data
<
0
||
!
this
.
$mp
.
page
)
return
if
(
data
<
0
||
!
this
.
$mp
.
page
)
return
;
if
(
typeof
this
.
$mp
.
page
.
getTabBar
===
'function'
&&
if
(
this
.
$mp
.
page
.
getTabBar
())
{
typeof
this
.
$mp
.
page
.
getTabBar
===
"function"
&&
this
.
$mp
.
page
.
getTabBar
()
)
{
this
.
$mp
.
page
.
getTabBar
().
setData
({
this
.
$mp
.
page
.
getTabBar
().
setData
({
selected
:
data
selected
:
data
})
});
}
}
}
}
// 遍历所有组件有显示条件的id 是否包含地区导航组件
// 遍历所有组件有显示条件的id 是否包含地区导航组件
export
function
checkShowConditionIds
(
list
)
{
export
function
checkShowConditionIds
(
list
)
{
let
allCondition
=
[];
let
allCondition
=
[];
let
isAreaNavigation
=
false
;
let
isAreaNavigation
=
false
;
list
.
forEach
(
element
=>
{
list
.
forEach
(
element
=>
{
// 有地区导航组件
// 有地区导航组件
if
(
element
.
componentCode
==
'area-navigation'
)
{
if
(
element
.
componentCode
==
"area-navigation"
)
{
isAreaNavigation
=
true
isAreaNavigation
=
true
;
}
}
pollCondition
(
element
)
pollCondition
(
element
);
});
});
function
pollCondition
(
object
)
{
function
pollCondition
(
object
)
{
if
(
Object
.
prototype
.
toString
.
call
(
object
)
===
'[object Object]'
)
{
if
(
Object
.
prototype
.
toString
.
call
(
object
)
===
"[object Object]"
)
{
if
(
object
.
condition
!=
''
&&
object
.
condition
!=
undefined
)
{
if
(
object
.
condition
!=
""
&&
object
.
condition
!=
undefined
)
{
allCondition
.
push
(
object
.
condition
);
allCondition
.
push
(
object
.
condition
);
}
}
for
(
const
key
in
object
)
{
for
(
const
key
in
object
)
{
if
(
object
.
hasOwnProperty
(
key
))
{
if
(
object
.
hasOwnProperty
(
key
))
{
const
element
=
object
[
key
];
const
element
=
object
[
key
];
if
(
Object
.
prototype
.
toString
.
call
(
element
)
===
'[object Object]'
)
{
if
(
Object
.
prototype
.
toString
.
call
(
element
)
===
"[object Object]"
)
{
if
(
element
.
condition
!=
''
&&
element
.
condition
!=
undefined
)
{
if
(
element
.
condition
!=
""
&&
element
.
condition
!=
undefined
)
{
allCondition
.
push
(
element
.
condition
);
allCondition
.
push
(
element
.
condition
);
}
}
pollCondition
(
element
)
pollCondition
(
element
);
}
else
if
(
Object
.
prototype
.
toString
.
call
(
element
)
===
'[object Array]'
&&
element
.
length
>
0
)
{
}
else
if
(
element
.
forEach
((
item
)
=>
{
Object
.
prototype
.
toString
.
call
(
element
)
===
"[object Array]"
&&
pollCondition
(
item
)
element
.
length
>
0
})
)
{
element
.
forEach
(
item
=>
{
pollCondition
(
item
);
});
}
}
}
}
}
}
...
@@ -229,13 +300,13 @@ export function checkShowConditionIds(list) {
...
@@ -229,13 +300,13 @@ export function checkShowConditionIds(list) {
return
{
return
{
allCondition
:
[...
new
Set
(
allCondition
)],
allCondition
:
[...
new
Set
(
allCondition
)],
isAreaNavigation
isAreaNavigation
}
};
}
}
export
function
$themeArticleLike
(
item
,
callback
)
{
export
function
$themeArticleLike
(
item
,
callback
)
{
let
query
=
{
articleId
:
item
.
id
};
let
query
=
{
articleId
:
item
.
id
};
classificationApi
.
addLike
(
query
).
then
(
res
=>
{
classificationApi
.
addLike
(
query
).
then
(
res
=>
{
if
(
res
.
data
.
code
==
"200"
)
{
if
(
res
.
data
.
code
==
"200"
)
{
if
(
res
.
data
.
data
==
'true'
)
{
if
(
res
.
data
.
data
==
"true"
)
{
callback
(
"true"
);
callback
(
"true"
);
}
else
{
}
else
{
callback
(
"false"
);
callback
(
"false"
);
...
@@ -250,7 +321,8 @@ export function getCoupon(code, item) {
...
@@ -250,7 +321,8 @@ export function getCoupon(code, item) {
let
couponCode
=
code
;
let
couponCode
=
code
;
console
.
log
(
item
,
"------------------------242"
);
console
.
log
(
item
,
"------------------------242"
);
if
(
item
.
receiveCostType
==
1
)
{
if
(
item
.
receiveCostType
==
1
)
{
wx
.
showModal
({
wx
.
showModal
({
confirmColor
:
"#CA173B"
,
confirmColor
:
"#CA173B"
,
content
:
`是否消耗
${
usingIntegrals
}
积分领取`
content
:
`是否消耗
${
usingIntegrals
}
积分领取`
})
})
...
@@ -264,7 +336,7 @@ export function getCoupon(code, item) {
...
@@ -264,7 +336,7 @@ export function getCoupon(code, item) {
}
else
{
}
else
{
useCoupon
(
1
,
couponCode
,
usingIntegrals
);
useCoupon
(
1
,
couponCode
,
usingIntegrals
);
}
}
}
;
}
function
useCoupon
(
val
,
couponCode
,
usingIntegrals
)
{
function
useCoupon
(
val
,
couponCode
,
usingIntegrals
)
{
coupon
.
receive_coupon
(
couponCode
).
then
(
res
=>
{
coupon
.
receive_coupon
(
couponCode
).
then
(
res
=>
{
console
.
log
(
res
,
"cou137"
);
console
.
log
(
res
,
"cou137"
);
...
@@ -277,17 +349,17 @@ function useCoupon(val, couponCode, usingIntegrals) {
...
@@ -277,17 +349,17 @@ function useCoupon(val, couponCode, usingIntegrals) {
}
}
// item.receive=false;
// item.receive=false;
}
else
{
}
else
{
wx
.
showToast
({
title
:
res
.
data
.
msg
,
icon
:
"none"
});
wx
.
showToast
({
title
:
res
.
data
.
msg
,
icon
:
"none"
});
// item.receive=true;
// item.receive=true;
}
}
});
});
}
;
}
export
function
themeMemberCardClick
(
item
)
{
export
function
themeMemberCardClick
(
item
)
{
let
query
=
{
let
query
=
{
portalCardId
:
item
.
id
portalCardId
:
item
.
id
};
};
shop
.
getV3CardList
(
query
).
then
(
res
=>
{
shop
.
getV3CardList
(
query
).
then
(
res
=>
{
console
.
log
(
res
,
'--------------------282'
)
console
.
log
(
res
,
"--------------------282"
);
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
code
==
200
)
{
let
cardData
=
""
;
let
cardData
=
""
;
res
.
data
.
data
.
forEach
(
innerItem
=>
{
res
.
data
.
data
.
forEach
(
innerItem
=>
{
...
@@ -296,7 +368,9 @@ export function themeMemberCardClick(item) {
...
@@ -296,7 +368,9 @@ export function themeMemberCardClick(item) {
}
}
});
});
let
cardId
=
cardData
.
id
;
let
cardId
=
cardData
.
id
;
let
userInfo
=
wx
.
getStorageSync
(
"userInfo"
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
"userInfo"
))
:
""
;
let
userInfo
=
wx
.
getStorageSync
(
"userInfo"
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
"userInfo"
))
:
""
;
if
(
cardData
.
receiveWay
==
0
)
{
if
(
cardData
.
receiveWay
==
0
)
{
// 无门槛
// 无门槛
shop
.
drawV3Card
(
cardId
).
then
(
res
=>
{
shop
.
drawV3Card
(
cardId
).
then
(
res
=>
{
...
@@ -304,7 +378,7 @@ export function themeMemberCardClick(item) {
...
@@ -304,7 +378,7 @@ export function themeMemberCardClick(item) {
wx
.
showToast
({
wx
.
showToast
({
content
:
`开通【
${
cardData
.
title
}
】成功`
,
content
:
`开通【
${
cardData
.
title
}
】成功`
,
showCancel
:
false
,
showCancel
:
false
,
confirmColor
:
''
,
confirmColor
:
""
,
success
:
res
=>
{
success
:
res
=>
{
let
backParams
=
`&cardId=
${
cardData
.
id
}
`
;
let
backParams
=
`&cardId=
${
cardData
.
id
}
`
;
if
(
userInfo
.
mobilephone
)
{
if
(
userInfo
.
mobilephone
)
{
...
@@ -312,15 +386,15 @@ export function themeMemberCardClick(item) {
...
@@ -312,15 +386,15 @@ export function themeMemberCardClick(item) {
}
}
toPage
(
"/personalCenter/membershipCard"
,
backParams
);
toPage
(
"/personalCenter/membershipCard"
,
backParams
);
}
}
})
})
;
}
else
{
}
else
{
if
(
res
.
data
.
msg
==
"不能重复领卡"
)
{
if
(
res
.
data
.
msg
==
"不能重复领卡"
)
{
console
.
log
(
"---------------------------to-----1"
)
console
.
log
(
"---------------------------to-----1"
);
let
backParams
=
`&cardId=
${
cardData
.
id
}
`
;
let
backParams
=
`&cardId=
${
cardData
.
id
}
`
;
if
(
userInfo
.
mobilephone
)
{
if
(
userInfo
.
mobilephone
)
{
backParams
+=
`&userTel=
${
userInfo
.
mobilephone
}
`
;
backParams
+=
`&userTel=
${
userInfo
.
mobilephone
}
`
;
}
}
toPage
(
"/personalCenter/membershipCard"
,
backParams
);
toPage
(
"/personalCenter/membershipCard"
,
backParams
);
}
else
{
}
else
{
wx
.
showToast
({
title
:
res
.
data
.
msg
,
icon
:
"none"
});
wx
.
showToast
({
title
:
res
.
data
.
msg
,
icon
:
"none"
});
}
}
...
@@ -332,11 +406,11 @@ export function themeMemberCardClick(item) {
...
@@ -332,11 +406,11 @@ export function themeMemberCardClick(item) {
}
else
if
(
cardData
.
receiveWay
==
2
)
{
}
else
if
(
cardData
.
receiveWay
==
2
)
{
// 付费购买
// 付费购买
if
(
cardData
.
receiveStatus
==
0
)
{
if
(
cardData
.
receiveStatus
==
0
)
{
console
.
log
(
"---------------------------to-----2"
)
console
.
log
(
"---------------------------to-----2"
);
let
backParams
=
`&cardId=
${
cardData
.
id
}
`
;
let
backParams
=
`&cardId=
${
cardData
.
id
}
`
;
toPage
(
"/pay/payCard"
,
backParams
);
toPage
(
"/pay/payCard"
,
backParams
);
}
else
{
}
else
{
console
.
log
(
"---------------------------to-----3"
)
console
.
log
(
"---------------------------to-----3"
);
let
backParams
=
`&cardId=
${
cardData
.
id
}
`
;
let
backParams
=
`&cardId=
${
cardData
.
id
}
`
;
if
(
userInfo
.
mobilephone
)
{
if
(
userInfo
.
mobilephone
)
{
backParams
+=
`&userTel=
${
userInfo
.
mobilephone
}
`
;
backParams
+=
`&userTel=
${
userInfo
.
mobilephone
}
`
;
...
@@ -347,91 +421,129 @@ export function themeMemberCardClick(item) {
...
@@ -347,91 +421,129 @@ export function themeMemberCardClick(item) {
console
.
error
(
"无效的领取方式"
);
console
.
error
(
"无效的领取方式"
);
}
}
}
else
{
}
else
{
wx
.
showToast
({
title
:
res
.
data
.
msg
,
icon
:
"none"
});
wx
.
showToast
({
title
:
res
.
data
.
msg
,
icon
:
"none"
});
if
(
res
.
data
.
code
==
300
)
{
if
(
res
.
data
.
code
==
300
)
{
console
.
log
(
'----------334'
)
console
.
log
(
"----------334"
);
// 未登录
// 未登录
setTimeout
(()
=>
{
setTimeout
(()
=>
{
let
url
=
`/pages/login/main?back=
${
encodeURIComponent
(
'/'
)}
`
;
let
url
=
`/pages/login/main?back=
${
encodeURIComponent
(
"/"
)}
`
;
wx
.
navigateTo
({
url
:
url
});
wx
.
navigateTo
({
url
:
url
});
},
200
);
},
200
);
}
}
}
}
});
});
}
;
}
// 扫码
// 扫码
export
function
themeScanningCodeClick
()
{
export
function
themeScanningCodeClick
()
{
let
app
=
getApp
()
let
app
=
getApp
();
let
{
$themeToLink
}
=
app
;
let
{
$themeToLink
}
=
app
;
console
.
log
(
"themeScanningCodeClick"
)
console
.
log
(
"themeScanningCodeClick"
);
wx
.
scanCode
({
wx
.
scanCode
({
success
(
res
)
{
success
(
res
)
{
console
.
log
(
res
,
'-----scanCode-success'
)
console
.
log
(
res
,
"-----scanCode-success"
);
let
{
scanType
,
path
,
result
}
=
res
;
let
{
scanType
,
path
,
result
}
=
res
;
// 所有一维码类型
// 所有一维码类型
const
barCodeTypes
=
[
'AZTEC'
,
'CODABAR'
,
'CODE_39'
,
'CODE_93'
,
'CODE_128'
,
const
barCodeTypes
=
[
'EAN_8'
,
'EAN_13'
,
'ITF'
,
'MAXICODE'
,
'RSS_14'
,
'RSS_EXPANDED'
,
'UPC_A'
,
"AZTEC"
,
'UPC_E'
,
'UPC_EAN_EXTENSION'
,
'CODE_25'
];
"CODABAR"
,
if
(
scanType
==
'WX_CODE'
)
{
"CODE_39"
,
"CODE_93"
,
"CODE_128"
,
"EAN_8"
,
"EAN_13"
,
"ITF"
,
"MAXICODE"
,
"RSS_14"
,
"RSS_EXPANDED"
,
"UPC_A"
,
"UPC_E"
,
"UPC_EAN_EXTENSION"
,
"CODE_25"
];
if
(
scanType
==
"WX_CODE"
)
{
// 微信二维码
// 微信二维码
$themeToLink
({
$themeToLink
({
type
:
1.1
,
type
:
1.1
,
link
:
path
[
0
]
==
'/'
?
path
:
`/
${
path
}
`
link
:
path
[
0
]
==
"/"
?
path
:
`/
${
path
}
`
});
});
}
else
if
(
scanType
==
'QR_CODE'
)
{
}
else
if
(
scanType
==
"QR_CODE"
)
{
// 二维码
// 二维码
// http链接或h5链接
// http链接或h5链接
// type 1h5页面 1.1小程序页面 1.2http链接
// type 1h5页面 1.1小程序页面 1.2http链接
if
(
result
.
startsWith
(
'http'
)
||
result
.
startsWith
(
'/'
))
{
if
(
result
.
startsWith
(
"http"
)
||
result
.
startsWith
(
"/"
))
{
// 链接跳转
// 链接跳转
$themeToLink
({
$themeToLink
({
type
:
result
.
startsWith
(
'http'
)?
1.2
:
1
,
type
:
result
.
startsWith
(
"http"
)
?
1.2
:
1
,
link
:
result
link
:
result
})
});
}
else
{
}
else
{
// 跳转搜索页
// 跳转搜索页
$themeToLink
({
$themeToLink
({
type
:
1
,
type
:
1
,
link
:
'/contentSearch/contentSearch?placeHolderText='
+
result
link
:
"/contentSearch/contentSearch?placeHolderText="
+
result
})
});
}
}
}
else
if
(
barCodeTypes
.
includes
(
scanType
))
{
}
else
if
(
barCodeTypes
.
includes
(
scanType
))
{
// 一维码类型
// 一维码类型
const
data
=
{
const
data
=
{
"searchWord"
:
result
,
searchWord
:
result
,
"page"
:
1
,
page
:
1
,
"rows"
:
10
rows
:
10
}
};
goods
.
selectProductInfoOnEs
(
data
).
then
(
response
=>
{
goods
.
selectProductInfoOnEs
(
data
)
.
then
(
response
=>
{
const
res
=
response
.
data
.
data
;
const
res
=
response
.
data
.
data
;
if
(
res
.
total
>
1
)
{
if
(
res
.
total
>
1
)
{
// 多个 SKU 跳转商品搜索结果页,搜索框显示扫码内容,页面自动展示搜索结果;
// 多个 SKU 跳转商品搜索结果页,搜索框显示扫码内容,页面自动展示搜索结果;
$themeToLink
({
$themeToLink
({
type
:
1
,
type
:
1
,
link
:
`/goodsSearch/goodsSearch?placeHolderText=
${
result
}
&search_txt=
${
result
}
`
link
:
`/goodsSearch/goodsSearch?placeHolderText=
${
result
}
&search_txt=
${
result
}
`
})
});
}
else
if
(
res
.
total
==
1
)
{
}
else
if
(
res
.
total
==
1
)
{
const
item
=
res
.
list
[
0
];
const
item
=
res
.
list
[
0
];
// 唯一 SKU 跳转商品详情
// 唯一 SKU 跳转商品详情
$themeToLink
({
$themeToLink
({
type
:
1
,
type
:
1
,
link
:
`/goods/
${
item
.
productId
}
?terminalProductId=
${
item
.
terminalProductId
}
`
link
:
`/goods/
${
item
.
productId
}
?terminalProductId=
${
item
.
terminalProductId
}
`
});
});
}
else
{
}
else
{
// 提示:对不起,无法正确识别该条形码。请直接联系导购员;
// 提示:对不起,无法正确识别该条形码。请直接联系导购员;
wx
.
showModal
({
wx
.
showModal
({
content
:
'对不起 无法正确识别该条形码
\
n请直接联系导购员'
,
content
:
"对不起 无法正确识别该条形码
\
n请直接联系导购员"
,
showCancel
:
false
showCancel
:
false
});
});
}
}
}).
catch
(
console
.
log
);
})
.
catch
(
console
.
log
);
}
}
},
},
fail
(
res
)
{
fail
(
res
)
{
console
.
log
(
res
,
'-----scanCode-fail'
)
console
.
log
(
res
,
"-----scanCode-fail"
);
},
},
complete
(
res
)
{
complete
(
res
)
{
console
.
log
(
res
,
'-----scanCode-complete'
)
console
.
log
(
res
,
"-----scanCode-complete"
);
},
}
});
});
}
}
/**
* 缓存门店code、name
*/
export
function
setStoreInfo
({
offlineShopCode
,
offlineShopName
})
{
console
.
log
(
offlineShopCode
,
offlineShopName
,
'--setStoreInfo'
);
wx
.
setStorageSync
(
"offlineShopCode"
,
offlineShopCode
);
wx
.
setStorageSync
(
"offlineShopName"
,
offlineShopName
);
}
/**
*
* 获取门店code、name
*/
export
function
getStoreInfo
()
{
return
{
offlineShopCode
:
wx
.
getStorageSync
(
"offlineShopCode"
)
||
""
,
offlineShopName
:
wx
.
getStorageSync
(
"offlineShopName"
)
||
""
};
}
src/utils/request.js
View file @
402a60ed
...
@@ -13,7 +13,7 @@ export async function requestGET(url, options) {
...
@@ -13,7 +13,7 @@ export async function requestGET(url, options) {
method
:
"GET"
,
method
:
"GET"
,
header
:
{
header
:
{
"Shop-Mixid"
:
store
.
state
.
mixid
,
"Shop-Mixid"
:
store
.
state
.
mixid
,
"Offline-Shop-Code"
:
store
.
state
.
offlineShopCode
,
"Offline-Shop-Code"
:
wx
.
getStorageSync
(
'offlineShopCode'
)
||
""
,
"Authorization"
:
wx
.
getStorageSync
(
'sessionid'
)
||
""
,
"Authorization"
:
wx
.
getStorageSync
(
'sessionid'
)
||
""
,
"Region-id"
:
wx
.
getStorageSync
(
'location'
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
'location'
)).
systemRegionId
:
''
,
"Region-id"
:
wx
.
getStorageSync
(
'location'
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
'location'
)).
systemRegionId
:
''
,
"Area-Id"
:
wx
.
getStorageSync
(
'location'
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
'location'
)).
id
:
''
,
"Area-Id"
:
wx
.
getStorageSync
(
'location'
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
'location'
)).
id
:
''
,
...
@@ -38,7 +38,7 @@ export async function requestPOST(url, options) {
...
@@ -38,7 +38,7 @@ export async function requestPOST(url, options) {
header
:
{
header
:
{
"Shop-Mixid"
:
store
.
state
.
mixid
,
"Shop-Mixid"
:
store
.
state
.
mixid
,
"Authorization"
:
wx
.
getStorageSync
(
'sessionid'
)
||
""
,
"Authorization"
:
wx
.
getStorageSync
(
'sessionid'
)
||
""
,
"Offline-Shop-Code"
:
store
.
state
.
offlineShopCode
,
"Offline-Shop-Code"
:
wx
.
getStorageSync
(
'offlineShopCode'
)
||
""
,
"openId"
:
wx
.
getStorageSync
(
"openid"
)
||
''
,
"openId"
:
wx
.
getStorageSync
(
"openid"
)
||
''
,
"Region-id"
:
wx
.
getStorageSync
(
'location'
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
'location'
)).
systemRegionId
:
''
,
"Region-id"
:
wx
.
getStorageSync
(
'location'
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
'location'
)).
systemRegionId
:
''
,
"Area-Id"
:
wx
.
getStorageSync
(
'location'
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
'location'
)).
id
:
''
,
"Area-Id"
:
wx
.
getStorageSync
(
'location'
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
'location'
)).
id
:
''
,
...
@@ -64,7 +64,7 @@ export function requestPOST1(url, options) {
...
@@ -64,7 +64,7 @@ export function requestPOST1(url, options) {
"Content-Type"
:
"application/x-www-form-urlencoded"
,
"Content-Type"
:
"application/x-www-form-urlencoded"
,
"Shop-Mixid"
:
store
.
state
.
mixid
,
"Shop-Mixid"
:
store
.
state
.
mixid
,
Authorization
:
wx
.
getStorageSync
(
'sessionid'
)
||
""
,
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
:
''
,
"Region-id"
:
wx
.
getStorageSync
(
'location'
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
'location'
)).
systemRegionId
:
''
,
"Area-Id"
:
wx
.
getStorageSync
(
'location'
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
'location'
)).
id
:
''
,
"Area-Id"
:
wx
.
getStorageSync
(
'location'
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
'location'
)).
id
:
''
,
// "dubbo-tag": "ljx"
// "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