Commit 61d2c4bdf36ffcfef3fe66b506cbef7f1927ea99
1 parent
aa9333db
1. 直播分享 2. 券分享
Showing
5 changed files
with
161 additions
and
117 deletions
packageA/pages/liveStreamDetails/liveStreamDetails.js
@@ -397,6 +397,19 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un | @@ -397,6 +397,19 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un | ||
397 | onLoad: function (options) { | 397 | onLoad: function (options) { |
398 | var that = this; | 398 | var that = this; |
399 | this.getSystemInfo(); | 399 | this.getSystemInfo(); |
400 | + | ||
401 | + var first_leader=options.first_leader; | ||
402 | + if(first_leader){ | ||
403 | + //-- user_id代过来免登陆 -- | ||
404 | + getApp().globalData.user_id=first_leader; | ||
405 | + getApp().getUserFir(); | ||
406 | + //调用接口判断是不是会员 | ||
407 | + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+o.stoid+"/"+first_leader,{}).then(res=>{ | ||
408 | + if(res.data.code==0){ | ||
409 | + getApp().globalData.guide_id=res.data.data.id; | ||
410 | + } | ||
411 | + }) | ||
412 | + } | ||
400 | 413 | ||
401 | getApp().request.promiseGet("/api/weshop/wx/livelist/get",{ | 414 | getApp().request.promiseGet("/api/weshop/wx/livelist/get",{ |
402 | data:{ id: options.id } | 415 | data:{ id: options.id } |
packageA/pages/live_share/live_share.js
@@ -17,9 +17,7 @@ Page({ | @@ -17,9 +17,7 @@ Page({ | ||
17 | is_no_data:0, //没有数据 | 17 | is_no_data:0, //没有数据 |
18 | is_no_more:0, //没有更多数据 | 18 | is_no_more:0, //没有更多数据 |
19 | key_str:'', | 19 | key_str:'', |
20 | - pattern:0, //分成的方式 | ||
21 | - currentPage:1, //当前的页码 | ||
22 | - | 20 | + currentPage:1, //当前的页码 |
23 | share_hidden:1, //-- 分享的按钮隐藏 -- | 21 | share_hidden:1, //-- 分享的按钮隐藏 -- |
24 | }, | 22 | }, |
25 | 23 |
packageA/pages/quan/quan.js
1 | // packageA//pages/goods_share/goods_share.js | 1 | // packageA//pages/goods_share/goods_share.js |
2 | +var app=getApp(),oo = app.globalData.setting,os=oo,ut = require("../../../utils/util.js"); | ||
2 | Page({ | 3 | Page({ |
3 | 4 | ||
4 | /** | 5 | /** |
5 | * 页面的初始数据 | 6 | * 页面的初始数据 |
6 | */ | 7 | */ |
7 | - data: { | ||
8 | - // tab | ||
9 | - tab: ['秒杀','拼单','促销','专享礼包'], | ||
10 | - currentIndex: 0, | 8 | + data: { |
11 | //促销页tab | 9 | //促销页tab |
12 | tab2: ['免费发放'], | 10 | tab2: ['免费发放'], |
13 | - currentIndex2: 0, | ||
14 | - //秒杀和拼单底部tab | ||
15 | - currentIndex3: 0, | ||
16 | - // 控制价格 | ||
17 | - active1: false, | ||
18 | - // 控制佣金 | ||
19 | - active2: false, | ||
20 | - //popup | ||
21 | - hiddenPopup: true, | 11 | + currentIndex2:0, |
12 | + list:[], | ||
13 | + is_load:0, //是否正在加载 | ||
14 | + is_no_data:0, //没有数据 | ||
15 | + is_no_more:0, //没有更多数据 | ||
16 | + key_str:'', | ||
17 | + currentPage:1, //当前的页码 | ||
18 | + share_hidden:1, //-- 分享的按钮隐藏 -- | ||
19 | + hiddenPopup:1, | ||
22 | }, | 20 | }, |
23 | 21 | ||
24 | /** | 22 | /** |
25 | * 生命周期函数--监听页面加载 | 23 | * 生命周期函数--监听页面加载 |
26 | */ | 24 | */ |
27 | onLoad: function (options) { | 25 | onLoad: function (options) { |
28 | - | ||
29 | - }, | ||
30 | - | ||
31 | - /** | ||
32 | - * 生命周期函数--监听页面初次渲染完成 | ||
33 | - */ | ||
34 | - onReady: function () { | 26 | + var th=this; |
27 | + //接受有没有导购的参数 | ||
28 | + var first_leader=options.first_leader; | ||
29 | + if(first_leader){ | ||
30 | + //-- user_id代过来免登陆 -- | ||
31 | + getApp().globalData.user_id=first_leader; | ||
32 | + getApp().getUserFir(); | ||
33 | + } | ||
34 | + this.requestGoodsList(); | ||
35 | + this.setData({getcurday:ut.gettimestamp()}); | ||
35 | 36 | ||
36 | }, | 37 | }, |
37 | 38 | ||
38 | /** | 39 | /** |
39 | * 生命周期函数--监听页面显示 | 40 | * 生命周期函数--监听页面显示 |
40 | */ | 41 | */ |
41 | - onShow: function () { | ||
42 | - | ||
43 | - }, | 42 | + onShow: function () { }, |
44 | 43 | ||
45 | /** | 44 | /** |
46 | * 生命周期函数--监听页面隐藏 | 45 | * 生命周期函数--监听页面隐藏 |
@@ -48,14 +47,6 @@ Page({ | @@ -48,14 +47,6 @@ Page({ | ||
48 | onHide: function () { | 47 | onHide: function () { |
49 | 48 | ||
50 | }, | 49 | }, |
51 | - | ||
52 | - /** | ||
53 | - * 生命周期函数--监听页面卸载 | ||
54 | - */ | ||
55 | - onUnload: function () { | ||
56 | - | ||
57 | - }, | ||
58 | - | ||
59 | /** | 50 | /** |
60 | * 页面相关事件处理函数--监听用户下拉动作 | 51 | * 页面相关事件处理函数--监听用户下拉动作 |
61 | */ | 52 | */ |
@@ -74,71 +65,98 @@ Page({ | @@ -74,71 +65,98 @@ Page({ | ||
74 | * 用户点击右上角分享 | 65 | * 用户点击右上角分享 |
75 | */ | 66 | */ |
76 | onShareAppMessage: function () { | 67 | onShareAppMessage: function () { |
77 | - | 68 | + var th=this; |
69 | + var id=th.data.hui_active.id; | ||
70 | + var url="/packageA/pages/quan_pro/quan_pro?id="+id; | ||
71 | + | ||
72 | + if(getApp().globalData.user_id){ | ||
73 | + url+="&first_leader="+getApp().globalData.user_id; | ||
74 | + } | ||
75 | + var title=th.data.hui_active.name; | ||
76 | + var ob={ | ||
77 | + title:title, | ||
78 | + path:url, | ||
79 | + }; | ||
80 | + th.setData({share_hidden:1}); | ||
81 | + return ob; | ||
82 | + }, | ||
83 | + | ||
84 | + requestGoodsList:function(){ | ||
85 | + var th=this; | ||
86 | + if(th.data.is_load) return false; //-- 正在加载 | ||
87 | + if(th.data.is_no_data) return false; //-- 没有数据 | ||
88 | + if(th.data.is_no_more) return false; //-- 没有更多 | ||
89 | + th.data.is_load=1; | ||
90 | + | ||
91 | + var url="/api/weshop/prom/coupon/pageCouponList"; | ||
92 | + var req_data={ | ||
93 | + page:this.data.currentPage, | ||
94 | + store_id:oo.stoid, | ||
95 | + type:1 | ||
96 | + } | ||
97 | + | ||
98 | + //-- ---调用接口---- | ||
99 | + app.request.promiseGet(url,{data:req_data,isShowLoading:1}).then(res=>{ | ||
100 | + th.data.is_load=0; | ||
101 | + if(res.data.code==0 && res.data.data.pageData && res.data.data.pageData.length>0){ | ||
102 | + th.data.currentPage++; | ||
103 | + var data=res.data.data.pageData; | ||
104 | + if(res.data.data.page*10>res.data.data.total){th.setData({is_no_more:1});} | ||
105 | + var list=th.data.list; | ||
106 | + list=list.concat(data); | ||
107 | + th.setData({list:list}); | ||
108 | + }else{ | ||
109 | + if(th.data.currentPage==1){ | ||
110 | + th.setData({is_no_data:1}); | ||
111 | + } | ||
112 | + } | ||
113 | + }) | ||
78 | }, | 114 | }, |
115 | + | ||
116 | + | ||
117 | + //---点击分享优惠活动--- | ||
118 | + share_index:function(e){ | ||
119 | + | ||
120 | + //--先判断会员状态-- | ||
121 | + var user_info = getApp().globalData.userInfo; | ||
122 | + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
123 | + //getApp().my_warnning("请先登录",0,this); | ||
124 | + wx.navigateTo({ url: '/pages/togoin/togoin', }) | ||
125 | + return false; | ||
126 | + } | ||
127 | + | ||
128 | + var index=e.currentTarget.dataset.index; | ||
129 | + var item=this.data.list[index]; | ||
130 | + this.setData({share_hidden:0,hui_active:item}); | ||
131 | + | ||
132 | + var com = this.selectComponent("#share_button"); //组件的id | ||
133 | + com.set_type(1); | ||
134 | + }, | ||
135 | + //-- ---更多加载---- | ||
136 | + refresh:function(){ | ||
137 | + this.requestGoodsList(); | ||
138 | + }, | ||
139 | + | ||
140 | + //---点击分享优惠活动--- | ||
141 | + share_index:function(e){ | ||
142 | + | ||
143 | + //--先判断会员状态-- | ||
144 | + var user_info = getApp().globalData.userInfo; | ||
145 | + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
146 | + //getApp().my_warnning("请先登录",0,this); | ||
147 | + wx.navigateTo({ url: '/pages/togoin/togoin', }) | ||
148 | + return false; | ||
149 | + } | ||
150 | + | ||
151 | + var index=e.currentTarget.dataset.index; | ||
152 | + var item=this.data.list[index]; | ||
153 | + this.setData({share_hidden:0,hui_active:item}); | ||
154 | + | ||
155 | + var com = this.selectComponent("#share_button"); //组件的id | ||
156 | + com.set_type(1); | ||
157 | + }, | ||
158 | + | ||
159 | + | ||
160 | + | ||
79 | 161 | ||
80 | - // 点击价格排序 | ||
81 | - sort1() { | ||
82 | - if(this.data.active2) { | ||
83 | - this.setData({ | ||
84 | - active2: !this.data.active2 | ||
85 | - }); | ||
86 | - }; | ||
87 | - this.setData({ | ||
88 | - active1: !this.data.active1 | ||
89 | - }); | ||
90 | - | ||
91 | - }, | ||
92 | - // 点击佣金排序 | ||
93 | - sort2() { | ||
94 | - if(this.data.active1) { | ||
95 | - this.setData({ | ||
96 | - active1: !this.data.active1 | ||
97 | - }); | ||
98 | - }; | ||
99 | - this.setData({ | ||
100 | - active2: !this.data.active2 | ||
101 | - }); | ||
102 | - }, | ||
103 | - // 点击tab | ||
104 | - clickTab(e) { | ||
105 | - this.setData({ | ||
106 | - currentIndex: e.target.dataset.index, | ||
107 | - }); | ||
108 | - }, | ||
109 | - // 点击促销页tab | ||
110 | - clickTab2(e) { | ||
111 | - this.setData({ | ||
112 | - currentIndex2: e.target.dataset.index, | ||
113 | - }); | ||
114 | - }, | ||
115 | - // 点击秒杀和拼单底部tab | ||
116 | - clickTab3(e) { | ||
117 | - this.setData({ | ||
118 | - currentIndex3: e.target.dataset.index, | ||
119 | - }); | ||
120 | - }, | ||
121 | - // 关闭弹出层 | ||
122 | - closePopup() { | ||
123 | - this.setData({ | ||
124 | - hiddenPopup: true | ||
125 | - }); | ||
126 | - }, | ||
127 | - // 显示弹出层 | ||
128 | - showPopup() { | ||
129 | - this.setData({ | ||
130 | - hiddenPopup: false | ||
131 | - }); | ||
132 | - }, | ||
133 | - clickShare() { | ||
134 | - this.setData({ | ||
135 | - hiddenPopup: false | ||
136 | - }); | ||
137 | - }, | ||
138 | - select(e) { | ||
139 | - var index = e.target.dataset.index; | ||
140 | - this.setData({ | ||
141 | - hiddenPopup: true | ||
142 | - }); | ||
143 | - }, | ||
144 | }) | 162 | }) |
145 | \ No newline at end of file | 163 | \ No newline at end of file |
packageA/pages/quan/quan.json
1 | -{ | ||
2 | - "usingComponents": { | ||
3 | - "nodata": "/components/nodata/nodata" | 1 | +{ |
2 | + "usingComponents": { | ||
3 | + "nodata": "/components/nodata/nodata", | ||
4 | + "share_button": "/components/share/share" | ||
4 | }, | 5 | }, |
5 | "navigationBarTitleText": "优惠券列表", | 6 | "navigationBarTitleText": "优惠券列表", |
6 | "enablePullDownRefresh": false | 7 | "enablePullDownRefresh": false |
packageA/pages/quan/quan.wxml
1 | +<wxs module="filters" src="../../../utils/filter.wxs"></wxs> | ||
1 | <view class="container"> | 2 | <view class="container"> |
2 | <!-- 列表 --> | 3 | <!-- 列表 --> |
3 | <!-- <view class="list-container"> --> | 4 | <!-- <view class="list-container"> --> |
@@ -11,30 +12,42 @@ | @@ -11,30 +12,42 @@ | ||
11 | <scroll-view | 12 | <scroll-view |
12 | class="list" | 13 | class="list" |
13 | scroll-y="true" | 14 | scroll-y="true" |
15 | + bindscrolltolower="refresh" | ||
14 | scroll-anchoring | 16 | scroll-anchoring |
15 | refresher-enabled> | 17 | refresher-enabled> |
16 | - | ||
17 | - <!-- 暂无数据 --> | ||
18 | - <nodata nodataContainer="nodata">暂无数据</nodata> | ||
19 | - | ||
20 | - <block> | 18 | + |
19 | + <block wx:for="{{list}}"> | ||
21 | <view class="coupons bg-red"> | 20 | <view class="coupons bg-red"> |
22 | <view class="flex"> | 21 | <view class="flex"> |
23 | <view> | 22 | <view> |
24 | - <view class="coupon-hd ellipsis-2 fs36">全场通用券</view> | ||
25 | - <view class="deadline fs28 pdt10">限时使用:2012-12-31 至 2013-12-31</view> | 23 | + <view class="coupon-hd ellipsis-2 fs36">{{item.name}}</view> |
24 | + <view class="deadline fs28 pdt10" wx:if="{{item.endtype==0}}">限时使用: | ||
25 | + <text wx:if="{{item.starttype==1}}">{{filters.format_time(getcurday+3600*24*item.startdays)}}</text> | ||
26 | + <text wx:if="{{item.starttype==0 && item.use_start_time>0}}"> {{filters.format_time(item.use_start_time)}}</text>至 | ||
27 | + <text wx:if="{{item.use_end_time>0}}"> {{filters.format_time(item.use_end_time)}}</text><text wx:else>不限</text> | ||
28 | + </view> | ||
29 | + <view class="deadline fs28 pdt10" wx:else>限时使用: | ||
30 | + <text wx:if="{{item.starttype==1}}">{{filters.format_time(getcurday+3600*24*item.startdays)}}至</text> <text wx:if="{{item.days>0}}">{{filters.format_time(getcurday+3600*24*item.days)}}</text><text wx:else>不限</text> | ||
31 | + </view> | ||
26 | </view> | 32 | </view> |
27 | - <view class="price">¥<text class="fs80">25</text></view> | 33 | + <view class="price">¥<text class="fs80">{{filters.toFix(item.money,2)}}</text></view> |
28 | </view> | 34 | </view> |
29 | <view class="flex ai-center jc_sb pdt20"> | 35 | <view class="flex ai-center jc_sb pdt20"> |
30 | - <view class="coupon-ft ellipsis-2 fs28">全场任意产品通用</view> | ||
31 | - <view class="btn-share" bindtap="clickShare">分享</view> | 36 | + <view wx:if="{{item.useobjecttype==0}}" class="coupon-ft ellipsis-2 fs28">全场任意产品通用</view> |
37 | + <view wx:if="{{item.useobjecttype==1}}" class="coupon-ft ellipsis-2 fs28">名牌({{item.useobjectname}})</view> | ||
38 | + <view wx:if="{{item.useobjecttype==2}}" class="coupon-ft ellipsis-2 fs28">品类({{item.useobjectname}})</view> | ||
39 | + <view wx:if="{{item.useobjecttype==11}}" class="coupon-ft ellipsis-2 fs28">用途({{item.useobjectname}})</view> | ||
40 | + <view wx:if="{{item.useobjecttype==12}}" class="coupon-ft ellipsis-2 fs28">分类一({{item.useobjectname}})</view> | ||
41 | + <view wx:if="{{item.useobjecttype==20}}" class="coupon-ft ellipsis-2 fs28">单品({{item.useobjectname}})</view> | ||
42 | + | ||
43 | + <view bindtap="share_index" data-index="{{index}}" class="btn-share" >分享</view> | ||
32 | </view> | 44 | </view> |
33 | - </view> | ||
34 | - | 45 | + </view> |
35 | </block> | 46 | </block> |
36 | - | ||
37 | - <view class="no-more t-c">- 已全部加载 -</view> | 47 | + |
48 | + <!-- 暂无数据 --> | ||
49 | + <nodata wx:if="{{list.length==0}}" nodataContainer="nodata">暂无数据</nodata> | ||
50 | + <view wx:if="{{is_no_more}}" class="no-more t-c">- 已全部加载 -</view> | ||
38 | </scroll-view> | 51 | </scroll-view> |
39 | <!-- </view> --> | 52 | <!-- </view> --> |
40 | <view class="popup-container" hidden="{{hiddenPopup}}"> | 53 | <view class="popup-container" hidden="{{hiddenPopup}}"> |
@@ -48,4 +61,5 @@ | @@ -48,4 +61,5 @@ | ||
48 | </view> | 61 | </view> |
49 | </view> | 62 | </view> |
50 | </view> | 63 | </view> |
51 | - | 64 | +<!-- 分享控件,底部弹出 --> |
65 | +<share_button id="share_button" bind:cancel="cancel" bind:share_img="saveImageToPhotosAlbum" wx:if="{{!share_hidden}}"></share_button> |