Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-limited-sell-miniapp
·
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
baoss
5 years ago
Commit
4708809846f9999fdca2685022be4efb5be5886e
1 parent
f1516632
替换模板消息 review by bevishuang
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
57 deletions
app/models/common.js
app/pages/index/index.js
app/pages/product/detail/detail.js
app/utils/wechat-pay.js
app/models/common.js
View file @
4708809
import
api
from
'../common/api'
;
import
config
from
'../common/config.js'
import
config
from
'../common/config.js'
;
export
default
{
getUnionTypeWithUid
(
uid
)
{
let
param
=
{
...
...
@@ -13,46 +13,53 @@ export default {
});
},
postTmplId
(
params
)
{
let
app
=
getApp
();
let
that
=
this
;
//如果没有uid,不上报,否则接口报500
if
(
!
app
.
getUid
()
||
params
.
tmplIds
.
length
===
0
)
return
return
new
Promise
(
resolve
=>
{
wx
.
requestSubscribeMessage
({
tmplIds
:
params
.
tmplIds
,
success
(
res
)
{
console
.
log
(
res
)
let
tmplIds
=
res
delete
tmplIds
.
errMsg
tmplIds
=
JSON
.
stringify
(
tmplIds
)
//上报tmplIds
let
tmplIdParams
=
{
uid
:
app
.
getUid
(),
openId
:
app
.
getOpenID
(),
miniAppType
:
config
.
mini_app_type
,
templateIds
:
tmplIds
,
method
:
'mini.subscribe.add'
,
let
app
=
getApp
();
let
that
=
this
;
// 如果没有uid,不上报,否则接口报500
if
(
!
app
.
getUid
()
||
params
.
tmplIds
.
length
===
0
)
{
return
;
}
return
new
Promise
(
resolve
=>
{
wx
.
requestSubscribeMessage
({
tmplIds
:
params
.
tmplIds
,
success
(
res
)
{
console
.
log
(
res
);
let
tmplIds
=
res
;
delete
tmplIds
.
errMsg
;
tmplIds
=
JSON
.
stringify
(
tmplIds
);
// 上报tmplIds
let
tmplIdParams
=
{
uid
:
app
.
getUid
(),
openId
:
app
.
getOpenID
(),
miniAppType
:
config
.
mini_app_type
,
templateIds
:
tmplIds
,
method
:
'mini.subscribe.add'
,
};
console
.
log
(
'params'
,
tmplIdParams
);
api
.
get
({
data
:
tmplIdParams
}).
then
(
res
=>
{
resolve
(
res
);
});
},
fail
(
res
)
{
console
.
log
(
res
);
wx
.
showToast
({
title
:
res
.
errCode
===
20004
?
'消息未开启 请点击右上角,打开设置,开启消息'
:
res
.
errMsg
,
icon
:
'none'
,
duration
:
3000
,
});
setTimeout
(
function
()
{
resolve
();
},
3000
);
}
console
.
log
(
'params'
,
tmplIdParams
)
api
.
get
({
data
:
tmplIdParams
}).
then
(
res
=>
{
resolve
(
res
)
})
},
fail
(
res
)
{
console
.
log
(
res
)
wx
.
showToast
({
title
:
res
.
errCode
===
20004
?
'消息未开启 请点击右上角,打开设置,开启消息'
:
res
.
errMsg
,
icon
:
'none'
,
duration
:
3000
,
})
setTimeout
(
function
()
{
resolve
()
},
3000
)
}
})
})
});
});
}
}
};
...
...
app/pages/index/index.js
View file @
4708809
...
...
@@ -134,7 +134,7 @@ Page({
}
that
.
setData
({
listData
:
list
,
footText
:
list
.
length
>
0
?
''
:
'暂无更多内容'
footText
:
list
.
length
>
0
?
''
:
'暂无更多内容'
});
}
});
...
...
app/pages/product/detail/detail.js
View file @
4708809
...
...
@@ -11,7 +11,7 @@ import {
stringify
}
from
'../../../vendors/query-stringify'
;
import
wx
from
'../../../utils/wx'
;
import
commonService
from
'../../../models/common.js'
import
commonService
from
'../../../models/common.js'
;
let
app
=
getApp
();
let
router
=
global
.
router
;
let
yas
;
...
...
@@ -80,7 +80,7 @@ const QUEUE_SUCCESS = {
const
OFFLINE_STATUS
=
{
OFFLINE
:
1
,
OFFLINE_OVER
:
0
}
}
;
const
YB_TO_ASSIST_C
=
'YB_TO_ASSIST_C'
;
const
YB_ASSIST_SUCCESS_L
=
'YB_ASSIST_SUCCESS_L'
;
const
YB_INVITE_ASSIST_C
=
'YB_INVITE_ASSIST_C'
;
...
...
@@ -168,8 +168,9 @@ Page(Object.assign({
});
let
userInfo
=
app
.
getUserInfo
();
if
(
!
userInfo
.
wechat
||
!
this
.
getUserWechatId
())
{
this
.
goLogin
({
'login'
:
'0'
,
'type'
:
'redirectTo'
});
this
.
goLogin
({
login
:
'0'
,
type
:
'redirectTo'
});
return
;
}
...
...
@@ -551,7 +552,7 @@ Page(Object.assign({
let
userInfo
=
app
.
getUserInfo
();
if
(
!
userInfo
.
wechat
||
!
this
.
getUserWechatId
())
{
this
.
goLogin
({
'login'
:
'0'
});
this
.
goLogin
({
login
:
'0'
});
return
;
}
...
...
@@ -615,7 +616,7 @@ Page(Object.assign({
let
userInfo
=
app
.
getUserInfo
();
if
(
!
userInfo
.
wechat
||
!
this
.
getUserWechatId
())
{
this
.
goLogin
({
'login'
:
'0'
});
this
.
goLogin
({
login
:
'0'
});
return
;
}
...
...
@@ -704,19 +705,21 @@ Page(Object.assign({
});
},
toFollow
()
{
let
that
=
this
if
(
this
.
data
.
isFollow
)
{
return
let
that
=
this
;
if
(
this
.
data
.
isFollow
)
{
return
;
}
let
tmplIds
=
[
'WhCBCAO2ci_gSrDSzpMExhYAdnhlF0aqgr2YWzJG4EM'
,
'3KKWG1j-1ui2wE19aLcpCVSoKTsbWpnlmPIBLesHJqs'
];
let
tmplIds
=
[
'WhCBCAO2ci_gSrDSzpMExhYAdnhlF0aqgr2YWzJG4EM'
,
'3KKWG1j-1ui2wE19aLcpCVSoKTsbWpnlmPIBLesHJqs'
];
commonService
.
postTmplId
({
tmplIds
}).
then
(
res
=>
{
that
.
setData
({
isFollow
:
true
})
})
});
});
},
assistCancel
()
{
this
.
reload
();
...
...
@@ -793,8 +796,8 @@ Page(Object.assign({
},
goLogin
(
params
)
{
let
login
=
parseInt
(
params
[
'login'
])
||
1
;
let
type
=
params
[
'type'
]
||
'navigateTo'
;
let
login
=
parseInt
(
params
.
login
)
||
1
;
let
type
=
params
.
type
||
'navigateTo'
;
let
data
=
{};
if
(
this
.
data
.
originUid
)
{
...
...
app/utils/wechat-pay.js
View file @
4708809
...
...
@@ -97,7 +97,7 @@ function wechatPay(order) {
signType
:
data
.
signType
,
paySign
:
data
.
paySign
,
success
:
function
()
{
reportPayStatus
(
orderCode
,
orderAmount
,
true
);
...
...
Please
register
or
login
to post a comment