Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
mini-program
/
zhwy
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 5db0eaa5
authored
Nov 03, 2023
by
杨北旺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
添加异常处理
1 parent
3d5b679e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
26 deletions
api/env/index.js
api/module/shopmall.js
components/Store/index.js
pages/tab/index/index.js
api/env/index.js
View file @
5db0eaa
import
{
preReleaseAppId
}
from
'~/config'
import
{
preReleaseAppId
}
from
'~/config'
const
target
=
[
'ip'
,
'dev'
,
'uat'
,
'prod'
,
'preRelease'
]
const
target
=
[
'ip'
,
'dev'
,
'uat'
,
'prod'
,
'preRelease'
]
let
index
=
2
let
index
=
3
/**
/**
*
*
...
...
api/module/shopmall.js
View file @
5db0eaa
...
@@ -234,6 +234,6 @@ module.exports = {
...
@@ -234,6 +234,6 @@ module.exports = {
return
api
.
post
({
return
api
.
post
({
method
:
`scrm.api.shopmall.weapp.merchant.detail.list`
,
method
:
`scrm.api.shopmall.weapp.merchant.detail.list`
,
...
data
...
data
})
}
,
true
)
},
},
};
};
components/Store/index.js
View file @
5db0eaa
import
{
IMG_URL
}
from
'~/config'
;
import
{
IMG_URL
}
from
'~/config'
;
import
{
env
}
from
'~/api/env/index'
import
{
env
}
from
'~/api/env/index'
import
{
MERCHANT_STATIC_LIST
}
from
'~/utils/constants'
import
{
MERCHANT_STATIC_LIST
}
from
'~/utils/constants'
Component
({
Component
({
properties
:
{
properties
:
{
show
:{
show
:
{
type
:
Boolean
,
type
:
Boolean
,
observer
(
n
)
{
observer
(
n
)
{
if
(
n
)
this
.
getMerchantList
()
if
(
n
)
this
.
getMerchantList
()
}
}
...
@@ -35,9 +35,10 @@ Component({
...
@@ -35,9 +35,10 @@ Component({
}
}
},
},
// 获取门店信息
// 获取门店信息
async
getMerchantList
()
{
async
getMerchantList
()
{
const
have_enter
=
this
.
checkFirst
()
if
(
have_enter
)
return
const
have_enter
=
this
.
checkFirst
()
if
(
have_enter
)
return
// 获取mock配置门店
// 获取mock配置门店
const
MOCKDATA
=
wx
.
p
.
storage
.
get
(
"mock_data"
);
const
MOCKDATA
=
wx
.
p
.
storage
.
get
(
"mock_data"
);
let
MerchantList
=
MERCHANT_STATIC_LIST
[
env
]
let
MerchantList
=
MERCHANT_STATIC_LIST
[
env
]
...
@@ -48,17 +49,25 @@ Component({
...
@@ -48,17 +49,25 @@ Component({
}
}
}
}
let
storeList
=
[],
index
=
0
let
storeList
=
[],
index
=
0
storeList
=
await
this
.
getMerchantListData
(
MerchantList
)
try
{
storeList
.
forEach
((
ele
,
i
)
=>
{
storeList
=
await
this
.
getMerchantListData
(
MerchantList
)
ele
.
merchantId
=
ele
.
merchantNo
if
(
!
storeList
)
throw
false
if
(
this
.
defaultMerchant
==
ele
.
merchantId
)
{
storeList
.
forEach
((
ele
,
i
)
=>
{
index
=
i
ele
.
merchantId
=
ele
.
merchantNo
}
if
(
this
.
defaultMerchant
==
ele
.
merchantId
)
{
})
index
=
i
this
.
setData
({
}
storeList
,
})
show
:
true
this
.
setData
({
})
storeList
,
show
:
true
})
}
catch
(
error
)
{
this
.
setData
({
storeList
:[],
show
:
false
})
}
},
},
// 选择门店
// 选择门店
toSelect
(
e
)
{
toSelect
(
e
)
{
...
@@ -75,15 +84,16 @@ Component({
...
@@ -75,15 +84,16 @@ Component({
show
:
false
show
:
false
})
})
},
},
// 获取门店列表
// 获取门店列表
async
getMerchantListData
(
merchantIdList
)
{
async
getMerchantListData
(
merchantIdList
)
{
const
res
=
await
wx
.
p
.
api
.
shopmallApi
.
getStoreList
({
merchantIdList
})
const
res
=
await
wx
.
p
.
api
.
shopmallApi
.
getStoreList
({
merchantIdList
})
return
res
||
[]
if
(
res
.
code
==
0
)
return
res
.
data
},
else
return
false
},
},
},
lifetimes
:
{
lifetimes
:
{
attached
()
{
attached
()
{
}
}
}
}
})
})
pages/tab/index/index.js
View file @
5db0eaa
...
@@ -185,7 +185,8 @@ Page({
...
@@ -185,7 +185,8 @@ Page({
// 获取门店列表
// 获取门店列表
async
getMerchantListData
(
merchantIdList
)
{
async
getMerchantListData
(
merchantIdList
)
{
const
res
=
await
wx
.
p
.
api
.
shopmallApi
.
getStoreList
({
merchantIdList
})
const
res
=
await
wx
.
p
.
api
.
shopmallApi
.
getStoreList
({
merchantIdList
})
return
res
||
[]
if
(
res
.
code
==
0
)
return
res
.
data
else
return
false
},
},
// 获取选择门店的信息
// 获取选择门店的信息
getMerchantIdDetail
(
merchantId
)
{
getMerchantIdDetail
(
merchantId
)
{
...
...
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