l_open.js
1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
var util = require('../../utils/util.js')
var uri=require('../../utils/uri.js')
Page({
onLoad:function(opt){
this.setData({
username:opt.username,
sellerid:opt.sellerid
})
this.getpayseller();
},
onShow:function(){
var that=this;
util.postSuccessFun=function(json,uri_code) {
switch (uri_code) {
case uri.CGI__USER_GETOPENBYOPENID__CODE: //获取当前用户是否开通支付产品
if(json.ret==200){
that.setData({
seller:json.data[0][0]
})
console.log(json.data[0])
}
break;
case uri.CGI__USER_OPENDCBYPAY__CODE:
if(json.ret==200){
wx.reLaunch({
url:'../me/s_index?sellerid='+that.data.sellerid
})
}
break;
}
}
},
getpayseller:function(){
util.post(uri.CGI__USER_GETOPENBYOPENID,{openid:util.cache('openid')},uri.CGI__USER_GETOPENBYOPENID__CODE)
},
getopendc:function(){
util.post(uri.CGI__USER_OPENDCBYPAY,{openid:util.cache('openid'),sellerid:this.data.sellerid,username:this.data.username},uri.CGI__USER_OPENDCBYPAY__CODE)
},
netchange:function(){
this.onShow();
}
})