Commit be5a64a80ca85961689884612352696f1f49a53d
1 parent
e8cc3c5f
优惠券分享
Showing
2 changed files
with
70 additions
and
1 deletions
packageA/pages/quan_list/quan_list.js
@@ -32,6 +32,9 @@ Page({ | @@ -32,6 +32,9 @@ Page({ | ||
32 | //---展示--- | 32 | //---展示--- |
33 | onShow: function () { | 33 | onShow: function () { |
34 | 34 | ||
35 | + //检查能不能分享 | ||
36 | + getApp().check_can_share(); | ||
37 | + | ||
35 | console.log("onShow:1"); | 38 | console.log("onShow:1"); |
36 | this.data.curpage = 1; | 39 | this.data.curpage = 1; |
37 | this.setData({ dataList: null }); | 40 | this.setData({ dataList: null }); |
@@ -41,6 +44,8 @@ Page({ | @@ -41,6 +44,8 @@ Page({ | ||
41 | //var data = [{ is_get:0,money:50,condition:500,id:1,name: "券名字", endtype: 0, use_start_time: 1579596090, use_end_time: 1611218490, everyone_num: 2,interval_time:1,color:"red"}]; | 44 | //var data = [{ is_get:0,money:50,condition:500,id:1,name: "券名字", endtype: 0, use_start_time: 1579596090, use_end_time: 1611218490, everyone_num: 2,interval_time:1,color:"red"}]; |
42 | //th.setData({dataList: data}); | 45 | //th.setData({dataList: data}); |
43 | this.setData({ getcurday: ut.gettimestamp() }); | 46 | this.setData({ getcurday: ut.gettimestamp() }); |
47 | + | ||
48 | + | ||
44 | }, | 49 | }, |
45 | 50 | ||
46 | onHide: function () { | 51 | onHide: function () { |
@@ -184,5 +189,36 @@ Page({ | @@ -184,5 +189,36 @@ Page({ | ||
184 | var index = e.currentTarget.dataset.ind; | 189 | var index = e.currentTarget.dataset.ind; |
185 | var item = this.data.dataList[index]; | 190 | var item = this.data.dataList[index]; |
186 | getApp().goto("/packageA/pages/quan_pro/quan_pro?id=" + item.id); | 191 | getApp().goto("/packageA/pages/quan_pro/quan_pro?id=" + item.id); |
187 | - } | 192 | + }, |
193 | + | ||
194 | + | ||
195 | + //发送给好友 | ||
196 | + onShareAppMessage:async function(e) { | ||
197 | + getApp().globalData.no_clear=1; | ||
198 | + var url= `packageA/pages/quan_list/quan_list`; | ||
199 | + var userInfo = getApp().globalData.userInfo; | ||
200 | + //是分销商才带 | ||
201 | + if (userInfo) { | ||
202 | + url += "&first_leader=" + userInfo.user_id; | ||
203 | + } | ||
204 | + var ob = { | ||
205 | + title:"优惠券列表", | ||
206 | + path: url, | ||
207 | + //imageUrl:this.data.url+this.data.store_config.store_logo, | ||
208 | + }; | ||
209 | + return ob; | ||
210 | + }, | ||
211 | + | ||
212 | + //发送给朋友圈 | ||
213 | + onShareTimeline() { | ||
214 | + getApp().globalData.no_clear=1; | ||
215 | + var user_id= getApp().globalData.user_id | ||
216 | + return { | ||
217 | + title:"优惠券列表", | ||
218 | + query: 'first_leader='+user_id | ||
219 | + } | ||
220 | + }, | ||
221 | + | ||
222 | + | ||
223 | + | ||
188 | }); | 224 | }); |
packageA/pages/quan_pro/quan_pro.js
@@ -44,6 +44,10 @@ Page({ | @@ -44,6 +44,10 @@ Page({ | ||
44 | 44 | ||
45 | //---展示,显示券的信息--- | 45 | //---展示,显示券的信息--- |
46 | onShow: function() { | 46 | onShow: function() { |
47 | + | ||
48 | + //检查能不能分享 | ||
49 | + getApp().check_can_share(); | ||
50 | + | ||
47 | var th=this; | 51 | var th=this; |
48 | var user_id=getApp().globalData.user_id; | 52 | var user_id=getApp().globalData.user_id; |
49 | getApp().request.promiseGet("/api/weshop/prom/coupon/pageCouponList", { | 53 | getApp().request.promiseGet("/api/weshop/prom/coupon/pageCouponList", { |
@@ -170,4 +174,33 @@ Page({ | @@ -170,4 +174,33 @@ Page({ | ||
170 | show_success:0 | 174 | show_success:0 |
171 | }) | 175 | }) |
172 | }, | 176 | }, |
177 | + | ||
178 | + //发送给好友 | ||
179 | + onShareAppMessage:async function(e) { | ||
180 | + getApp().globalData.no_clear=1; | ||
181 | + var url= "packageA/pages/quan_pro/quan_pro?id="+this.data.id; | ||
182 | + var userInfo = getApp().globalData.userInfo; | ||
183 | + //是分销商才带 | ||
184 | + if (userInfo) { | ||
185 | + url += "&first_leader=" + userInfo.user_id; | ||
186 | + } | ||
187 | + var ob = { | ||
188 | + title:this.data.q_data.name, | ||
189 | + path: url, | ||
190 | + //imageUrl:this.data.url+this.data.store_config.store_logo, | ||
191 | + }; | ||
192 | + return ob; | ||
193 | + }, | ||
194 | + | ||
195 | + //发送给朋友圈 | ||
196 | + onShareTimeline() { | ||
197 | + getApp().globalData.no_clear=1; | ||
198 | + var user_id= getApp().globalData.user_id | ||
199 | + return { | ||
200 | + title:this.data.q_data.name, | ||
201 | + query: 'first_leader='+user_id | ||
202 | + } | ||
203 | + }, | ||
204 | + | ||
205 | + | ||
173 | }); | 206 | }); |