From be5a64a80ca85961689884612352696f1f49a53d Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Mon, 5 Sep 2022 14:27:41 +0800 Subject: [PATCH] 优惠券分享 --- packageA/pages/quan_list/quan_list.js | 38 +++++++++++++++++++++++++++++++++++++- packageA/pages/quan_pro/quan_pro.js | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/packageA/pages/quan_list/quan_list.js b/packageA/pages/quan_list/quan_list.js index 3baf596..0dce543 100644 --- a/packageA/pages/quan_list/quan_list.js +++ b/packageA/pages/quan_list/quan_list.js @@ -32,6 +32,9 @@ Page({ //---展示--- onShow: function () { + //检查能不能分享 + getApp().check_can_share(); + console.log("onShow:1"); this.data.curpage = 1; this.setData({ dataList: null }); @@ -41,6 +44,8 @@ Page({ //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"}]; //th.setData({dataList: data}); this.setData({ getcurday: ut.gettimestamp() }); + + }, onHide: function () { @@ -184,5 +189,36 @@ Page({ var index = e.currentTarget.dataset.ind; var item = this.data.dataList[index]; getApp().goto("/packageA/pages/quan_pro/quan_pro?id=" + item.id); - } + }, + + + //发送给好友 + onShareAppMessage:async function(e) { + getApp().globalData.no_clear=1; + var url= `packageA/pages/quan_list/quan_list`; + var userInfo = getApp().globalData.userInfo; + //是分销商才带 + if (userInfo) { + url += "&first_leader=" + userInfo.user_id; + } + var ob = { + title:"优惠券列表", + path: url, + //imageUrl:this.data.url+this.data.store_config.store_logo, + }; + return ob; + }, + + //发送给朋友圈 + onShareTimeline() { + getApp().globalData.no_clear=1; + var user_id= getApp().globalData.user_id + return { + title:"优惠券列表", + query: 'first_leader='+user_id + } + }, + + + }); diff --git a/packageA/pages/quan_pro/quan_pro.js b/packageA/pages/quan_pro/quan_pro.js index 59d4fde..fb73492 100644 --- a/packageA/pages/quan_pro/quan_pro.js +++ b/packageA/pages/quan_pro/quan_pro.js @@ -44,6 +44,10 @@ Page({ //---展示,显示券的信息--- onShow: function() { + + //检查能不能分享 + getApp().check_can_share(); + var th=this; var user_id=getApp().globalData.user_id; getApp().request.promiseGet("/api/weshop/prom/coupon/pageCouponList", { @@ -170,4 +174,33 @@ Page({ show_success:0 }) }, + + //发送给好友 + onShareAppMessage:async function(e) { + getApp().globalData.no_clear=1; + var url= "packageA/pages/quan_pro/quan_pro?id="+this.data.id; + var userInfo = getApp().globalData.userInfo; + //是分销商才带 + if (userInfo) { + url += "&first_leader=" + userInfo.user_id; + } + var ob = { + title:this.data.q_data.name, + path: url, + //imageUrl:this.data.url+this.data.store_config.store_logo, + }; + return ob; + }, + + //发送给朋友圈 + onShareTimeline() { + getApp().globalData.no_clear=1; + var user_id= getApp().globalData.user_id + return { + title:this.data.q_data.name, + query: 'first_leader='+user_id + } + }, + + }); -- libgit2 0.21.4