Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-miniapp-eshop
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
李奇
7 years ago
Commit
dd6b10786ecbb4b61ef93b89b5b4e0069b377504
1 parent
9fbf8d98
获取绑定店铺逻辑迁移
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
15 deletions
app/app.js
app/pages/home/order/detail.js
app/pages/index/index.js
app/app.js
View file @
dd6b107
...
...
@@ -5,6 +5,7 @@ import {verify} from './common/api';
import
Promise
from
'./vendors/es6-promise'
;
import
{
MD5
}
from
'./vendors/crypto'
;
import
{
wechatAuthLogin
,
verifySessionKey
}
from
'./common/login'
;
import
commonModel
from
'./models/common'
;
import
{
stringify
}
from
'./vendors/query-stringify'
;
import
'./router/index'
;
import
Yas
from
'./common/yas'
;
...
...
@@ -86,6 +87,8 @@ App({
yas
.
report
(
'YB_LAUNCH_APP'
);
},
onShow
(
options
)
{
this
.
getUnionShop
();
// 设置微信场景
this
.
globalData
.
ch
=
options
.
scene
;
...
...
@@ -129,6 +132,20 @@ App({
console
.
log
(
`
wx
.
setStorageSync
set
$
{
key
}
failed
.
`
);
}
},
getUnionShop
:
function
()
{
if
(
this
.
globalData
.
unionShop
&&
this
.
globalData
.
unionShop
.
shopId
)
{
event
.
emit
(
'get-union-shop-success'
);
}
else
{
commonModel
.
getBindShop
({
app_id
:
this
.
getAppId
()}).
then
(
res
=>
{
if
(
res
.
code
===
200
&&
res
.
data
.
shopId
)
{
this
.
globalData
.
unionShop
=
res
.
data
;
event
.
emit
(
'get-union-shop-success'
);
}
else
{
return
Promise
.
reject
();
}
}).
catch
(()
=>
{});
}
},
getWechatThirdSession
()
{
this
.
globalData
.
thirdSession
=
this
.
_getSync
(
'thirdSession'
);
return
this
.
globalData
.
thirdSession
;
...
...
app/pages/home/order/detail.js
View file @
dd6b107
...
...
@@ -138,7 +138,11 @@ Page({
deleteOrder
()
{
orderHandle
.
deleteOrder
(
this
.
orderCode
,
res
=>
{
if
(
res
&&
res
.
code
===
200
)
{
wx
.
navigateBack
({
delta
:
1
});
if
(
getCurrentPages
().
length
>
1
)
{
wx
.
navigateBack
({
delta
:
1
});
}
else
{
router
.
go
(
'orderList'
,
{
type
:
1
});
}
}
});
},
...
...
app/pages/index/index.js
View file @
dd6b107
import
wx
from
'../../utils/wx'
;
import
Yas
from
'../../common/yas'
;
import
Promise
from
'../../vendors/es6-promise'
;
import
commonModel
from
'../../models/common'
;
import
event
from
'../../common/event'
;
import
indexModel
from
'../../models/index/index'
;
let
yas
;
...
...
@@ -47,18 +46,10 @@ Page({
this
.
getShopData
(
shopId
);
this
.
getShopProducts
(
shopId
);
}
else
{
commonModel
.
getBindShop
({
app_id
:
app
.
getAppId
()}).
then
(
res
=>
{
if
(
res
.
code
===
200
&&
res
.
data
.
shopId
)
{
const
id
=
res
.
data
.
shopId
;
app
.
globalData
.
unionShop
=
res
.
data
;
this
.
getShopData
(
id
);
this
.
getShopProducts
(
id
);
}
else
{
return
Promise
.
reject
();
}
}).
catch
(()
=>
{});
event
.
on
(
'get-union-shop-success'
,
()
=>
{
this
.
getShopData
(
app
.
getShopId
());
this
.
getShopProducts
(
app
.
getShopId
());
});
}
// 记录
...
...
Please
register
or
login
to post a comment