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 | 32 | //---展示--- |
| 33 | 33 | onShow: function () { |
| 34 | 34 | |
| 35 | + //检查能不能分享 | |
| 36 | + getApp().check_can_share(); | |
| 37 | + | |
| 35 | 38 | console.log("onShow:1"); |
| 36 | 39 | this.data.curpage = 1; |
| 37 | 40 | this.setData({ dataList: null }); |
| ... | ... | @@ -41,6 +44,8 @@ Page({ |
| 41 | 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 | 45 | //th.setData({dataList: data}); |
| 43 | 46 | this.setData({ getcurday: ut.gettimestamp() }); |
| 47 | + | |
| 48 | + | |
| 44 | 49 | }, |
| 45 | 50 | |
| 46 | 51 | onHide: function () { |
| ... | ... | @@ -184,5 +189,36 @@ Page({ |
| 184 | 189 | var index = e.currentTarget.dataset.ind; |
| 185 | 190 | var item = this.data.dataList[index]; |
| 186 | 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 | 44 | |
| 45 | 45 | //---展示,显示券的信息--- |
| 46 | 46 | onShow: function() { |
| 47 | + | |
| 48 | + //检查能不能分享 | |
| 49 | + getApp().check_can_share(); | |
| 50 | + | |
| 47 | 51 | var th=this; |
| 48 | 52 | var user_id=getApp().globalData.user_id; |
| 49 | 53 | getApp().request.promiseGet("/api/weshop/prom/coupon/pageCouponList", { |
| ... | ... | @@ -170,4 +174,33 @@ Page({ |
| 170 | 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 | }); | ... | ... |