evaluategift.js
6.17 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
var _default =
{
data: function data() {
return {
itemShow: false, //项目栏目是否显示
cardShow: false, //代金券栏目是否显示
packShow: false, //福利栏目是否显示
textShow: false, //规则是否显示
integralShow: true, //积分领取是否显示
growUpShow: true, //成长值领取是否显示
itemButton: '',
cardButton: '',
getActId: '',
getActType: '',
giftID: '',
getUserID: '',
getStorageID: '',
receiveState: '已领取',
integralTitle: '已领取',
growUpTitle: '已领取',
textTitle: '',
getUrl: '',
noShow: false,
//判断中间的连接线是否显示
itemShows: function itemShows() {
if (this.itemShow) {
if (this.cardShow) {
return true;
} else {
return false;
}
} else {
if (this.cardShow) {
return false;
} else {
return false;
}
}
},
//判断中间的连接线是否显示
cardShows: function cardShows() {
if (this.cardShow) {
if (this.packShow) {
return true;
} else {
return false;
}
} else {
if (this.packShow) {
return false;
} else {
return false;
}
}
},
cards: [],
itemWare: []
};
},
onLoad: function onLoad(options) {
// 获取url对应的参数
// this.getActId = this.GetQueryString('actId'); //活动id
// this.getActType = this.GetQueryString('actType'); //活动类型 1新人礼 2评价有礼 3节日营销 4生日营销
// this.giftID = this.GetQueryString('giftID'); //礼包ID
// this.getStorageID = this.GetQueryString('storageID'); //商家ID
// this.getUserID = this.GetQueryString('userID'); //用户ID
this.getActId = options.actId; //活动id
this.getActType = options.actType; //活动类型 1新人礼 2评价有礼 3节日营销 4生日营销
this.giftID = options.giftBagId; //礼包ID
this.getStorageID = options.storeId; //商家ID
this.getUserID = options.userId; //用户ID
this.GetList();
},
onShow: function onShow() {
this.textTitle = this.textTitle.replace(/<p><img/gi, "<p class='img'><img");
},
methods: {
getQueryString: function getQueryString(name) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
var r = window.location.search.substr(1).match(reg);
if (r != null) {
return unescape(r[2]);
}
return null;
},
GetList: function GetList() {
var _this = this;
uni.request({
url: this.$GetInfo.ApiHttp + '/api/weshop/marketing/giftbag/bound/get',
data: {
"actId": this.getActId, //活动id
"actType": this.getActType, //活动类型 1新人礼 2评价有礼 3节日营销 4生日营销
"giftBagId": this.giftID, //礼包ID
"storeId": this.getStorageID, //商家ID
"userId": this.getUserID //用户ID
},
method: 'GET',
header: {
'Content-Type': 'application/x-www-form-urlencoded' //自定义请求头信息
},
success: function success(res) {
console.log(res.data);
if (res.data.code == 0) {
if (res.data.data.lbCoupons != null) {
_this.cardShow = true;
_this.cards = res.data.data.lbCoupons;
}
if (res.data.data.lbSM != null) {
_this.itemShow = true;
_this.itemWare = res.data.data.lbSM;
}
if (res.data.data.lbIntegral <= 0) {
if (res.data.data.lbGrowthValue <= 0) {
_this.packShow = false;
} else {
_this.packShow = true;
_this.integralShow = false;
_this.growUpShow = true;
}
} else {
if (res.data.data.lbGrowthValue > 0) {
_this.packShow = true;
} else {
_this.packShow = true;
_this.integralShow = true;
_this.growUpShow = false;
}
}
_this.integralTitle = '领取' + res.data.data.lbIntegral + '积分';
_this.growUpTitle = '领取' + res.data.data.lbGrowthValue + '积分';
if (res.data.data.receiveState == 0) {
_this.receiveState = '一键全部领取';
} else {
_this.receiveState = '已领取';
}
if (res.data.data.actIntro != '') {
_this.textShow = true;
_this.textTitle = res.data.data.actIntro;
}
} else {
console.log(res.data.msg);
}
}
});
},
GetWebHttp: function GetWebHttp() {
this.getUrl = this.$GetInfo.HtmlHttp + '/mobile/index/index/stoid/' + this.getStorageID + '.html';
window.location.href = this.getUrl;
},
GetReceive: function GetReceive() {
var that = this;
if (that.receiveState == '已领取') {
return false;
}
uni.request({
url: that.$GetInfo.ApiHttp + '/api/weshop/marketing/free/receive/gift/record/insert',
data: {
"actId": that.getActId, //活动Id
"actType": '2', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销
"lbId": that.giftID, //礼包Id
"storeId": that.getStorageID, //商家Id
"userId": that.getUserID //用户ID
},
method: 'POST',
header: {
'Content-Type': 'application/json' //自定义请求头信息
},
success: function success(res) {
console.log(res.data);
if (res.data.code == 0) {
console.log(res.data.msg);
that.receiveState = '已领取';
uni.showToast({
icon: 'none',
title: '领取成功!'
});
} else {
console.log(res.data.msg);
uni.showToast({
icon: 'none',
title: res.data.msg
});
}
}
});
}
}
};