action-bar.js
2.28 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
// page/subPackage/pages/zeroSell/components/action-bar.js
import ZeroSellService from '../service/zero-sell'
import CommonService from '../service/common'
import router from '../router/router'
var app = null;
Component({
/**
* 组件的属性列表
*/
properties: {
status: {
type: Number,
value: 1
},
num: {
type: Number,
value: 2
},
shareUid: {
type: Number,
value: 0
},
actPrizeId: {
type: Number,
value: 0
}
},
/**
* 组件的初始数据
*/
data: {
show: false,
code: '',
error: false,
fellow: false
},
ready() {
this.service = new ZeroSellService();
this.commonService = new CommonService();
app = getApp();
},
/**
* 组件的方法列表
*/
methods: {
fetchCode() {
if (!app.getUid()) {
this.triggerEvent('requireauth');
return;
}
wx.showLoading({
mask: true
});
let userInfo = app.getUserInfo();
this.service.fetchCode({
shareUid: this.properties.shareUid,
uid: app.getUid(),
actPrizeId: this.properties.actPrizeId,
userThumb: userInfo.avatarUrl,
userName: userInfo.nickName
}).then(result => {
wx.hideLoading();
if (result.code === 200) {
this.setData({
show: true,
code: result.data.prizeCode
});
} else {
this.setData({
error: true,
errorText: result.message
});
}
});
},
goShare() {
this.triggerEvent('share');
},
goMyList() {
router.go('myList');
},
goList() {
if(getCurrentPages().length === 1) {
router.go('index');
} else {
wx.navigateBack()
}
},
cancelAlert() {
this.setData({
show: false,
error: false,
fellow: false
});
this.triggerEvent('getcode');
},
openFellowAlert() {
this.setData({
fellow: true
});
},
submitFormId(e) {
return this.commonService.addWechatFormId({
formId: e.detail.formId,
uid: app.getUid() || 0,
openId: app.getOpenID() || '',
miniapp_type: app.getMiniappType()
});
}
}
})