正在显示
8 个修改的文件
包含
275 行增加
和
102 行删除
@@ -6,8 +6,8 @@ Page({ | @@ -6,8 +6,8 @@ Page({ | ||
6 | * 页面的初始数据 | 6 | * 页面的初始数据 |
7 | */ | 7 | */ |
8 | data: { | 8 | data: { |
9 | - info:[], | ||
10 | - thumb:'' | 9 | + info: [], |
10 | + thumb: '' | ||
11 | }, | 11 | }, |
12 | 12 | ||
13 | //畅玩卡介绍 | 13 | //畅玩卡介绍 |
@@ -25,7 +25,7 @@ Page({ | @@ -25,7 +25,7 @@ Page({ | ||
25 | }, | 25 | }, |
26 | 26 | ||
27 | //前往团购 | 27 | //前往团购 |
28 | - goBuy(){ | 28 | + goBuy() { |
29 | wx.navigateTo({ | 29 | wx.navigateTo({ |
30 | url: '/pages/my/groupBuy/groupBuy', | 30 | url: '/pages/my/groupBuy/groupBuy', |
31 | }) | 31 | }) |
@@ -84,6 +84,26 @@ Page({ | @@ -84,6 +84,26 @@ Page({ | ||
84 | * 用户点击右上角分享 | 84 | * 用户点击右上角分享 |
85 | */ | 85 | */ |
86 | onShareAppMessage: function() { | 86 | onShareAppMessage: function() { |
87 | - | 87 | + let that = this; |
88 | + // 设置菜单中的转发按钮触发转发事件时的转发内容 | ||
89 | + var shareObj = { | ||
90 | + title: '科学队长', // 默认是小程序的名称(可以写slogan等) | ||
91 | + path: '/pages/my/cardIntroduction/cardIntroduction', // 默认是当前页面,必须是以‘/’开头的完整路径 | ||
92 | + imageUrl: '', //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4 | ||
93 | + success: function(res) { | ||
94 | + if (res.errMsg == 'shareAppMessage:ok') {} | ||
95 | + }, | ||
96 | + fail: function() { | ||
97 | + // 转发失败之后的回调 | ||
98 | + if (res.errMsg == 'shareAppMessage:fail cancel') { | ||
99 | + // 用户取消转发 | ||
100 | + } else if (res.errMsg == 'shareAppMessage:fail') { | ||
101 | + // 转发失败,其中 detail message 为详细失败信息 | ||
102 | + } | ||
103 | + }, | ||
104 | + complete: function() { | ||
105 | + // 转发结束之后的回调(转发成不成功都会执行) | ||
106 | + } | ||
107 | + } | ||
88 | } | 108 | } |
89 | }) | 109 | }) |
1 | // pages/groupBuy/groupBuy.js | 1 | // pages/groupBuy/groupBuy.js |
2 | const app = getApp() | 2 | const app = getApp() |
3 | + const time=require('../../../utils/util.js'); | ||
3 | Page({ | 4 | Page({ |
4 | 5 | ||
5 | /** | 6 | /** |
@@ -7,12 +8,12 @@ | @@ -7,12 +8,12 @@ | ||
7 | */ | 8 | */ |
8 | data: { | 9 | data: { |
9 | current: 0, | 10 | current: 0, |
10 | - chargenum: "2059788797", | 11 | + chargenum: "", |
11 | page: 0, | 12 | page: 0, |
12 | groupList: [], | 13 | groupList: [], |
13 | recordList: [], | 14 | recordList: [], |
14 | pay_info: [], | 15 | pay_info: [], |
15 | - is_agree:false | 16 | + is_agree: false |
16 | }, | 17 | }, |
17 | 18 | ||
18 | //tab切换 | 19 | //tab切换 |
@@ -27,12 +28,14 @@ | @@ -27,12 +28,14 @@ | ||
27 | }) | 28 | }) |
28 | } | 29 | } |
29 | }, | 30 | }, |
31 | + | ||
30 | //同意协议按钮 | 32 | //同意协议按钮 |
31 | agree() { | 33 | agree() { |
32 | this.setData({ | 34 | this.setData({ |
33 | is_agree: !this.data.is_agree | 35 | is_agree: !this.data.is_agree |
34 | }) | 36 | }) |
35 | }, | 37 | }, |
38 | + | ||
36 | //服务协议 | 39 | //服务协议 |
37 | serviceProtocol() { | 40 | serviceProtocol() { |
38 | wx.navigateTo({ | 41 | wx.navigateTo({ |
@@ -98,26 +101,19 @@ | @@ -98,26 +101,19 @@ | ||
98 | } | 101 | } |
99 | app.post(url, params, header).then((res) => { | 102 | app.post(url, params, header).then((res) => { |
100 | console.log(res) | 103 | console.log(res) |
101 | - this.setData({ | ||
102 | - recordList: res.list | ||
103 | - }) | ||
104 | - }) | ||
105 | - }, | ||
106 | - | ||
107 | - //发起团购 | ||
108 | - goPay() { | ||
109 | - let url = '/portal/Group/group_create' | ||
110 | - let params = {} | ||
111 | - let header = { | ||
112 | - "XX-Token": wx.getStorageSync('token') | 104 | + var recordList= res.list |
105 | + for(var i=0;i<recordList.length;i++){ | ||
106 | + var chargeTime = recordList[i].create_time | ||
107 | + chargeTime = time.formatTimeTwo(chargeTime, 'Y-M-D') | ||
108 | + console.log(chargeTime) | ||
109 | + recordList[i].create_time = chargeTime | ||
113 | } | 110 | } |
114 | - app.post(url, params, header).then((res) => { | ||
115 | this.setData({ | 111 | this.setData({ |
116 | - group_info: res.pay | 112 | + recordList: recordList |
117 | }) | 113 | }) |
118 | - this.wxPay(res.pay) | ||
119 | }) | 114 | }) |
120 | }, | 115 | }, |
116 | + | ||
121 | //团购配置人数价格 | 117 | //团购配置人数价格 |
122 | PayDetail() { | 118 | PayDetail() { |
123 | let url = '/portal/Group/group_option' | 119 | let url = '/portal/Group/group_option' |
@@ -126,7 +122,7 @@ | @@ -126,7 +122,7 @@ | ||
126 | "XX-Token": wx.getStorageSync('token') | 122 | "XX-Token": wx.getStorageSync('token') |
127 | } | 123 | } |
128 | app.post(url, params, header).then((res) => { | 124 | app.post(url, params, header).then((res) => { |
129 | - console.log(res) | 125 | + // console.log(res) |
130 | this.setData({ | 126 | this.setData({ |
131 | pay_info: res.info | 127 | pay_info: res.info |
132 | }) | 128 | }) |
@@ -140,46 +136,65 @@ | @@ -140,46 +136,65 @@ | ||
140 | "XX-Token": wx.getStorageSync('token') | 136 | "XX-Token": wx.getStorageSync('token') |
141 | } | 137 | } |
142 | app.post(url, {}, {}).then((res) => { | 138 | app.post(url, {}, {}).then((res) => { |
143 | - console.log('团购规则',res) | 139 | + // console.log('团购规则', res) |
144 | this.setData({ | 140 | this.setData({ |
145 | rule: res | 141 | rule: res |
146 | }) | 142 | }) |
147 | }) | 143 | }) |
148 | }, | 144 | }, |
145 | + | ||
146 | + //发起团购 | ||
147 | + goPay(e) { | ||
148 | + // var id=e.currentTarget.dataset.id | ||
149 | + let url = '/portal/Group/group_create' | ||
150 | + let params = {} | ||
151 | + let header = { | ||
152 | + "XX-Token": wx.getStorageSync('token') | ||
153 | + } | ||
154 | + app.post(url, params, header).then((res) => { | ||
155 | + // wx.setStorageSync('group_id', res.group_id) | ||
156 | + this.setData({ | ||
157 | + group_info: res.pay, | ||
158 | + group_id: res.group_id | ||
159 | + }) | ||
160 | + this.wxPay(res.pay) | ||
161 | + }) | ||
162 | + }, | ||
163 | + | ||
149 | //发起团购支付 | 164 | //发起团购支付 |
150 | wxPay(data) { | 165 | wxPay(data) { |
151 | const self = this; | 166 | const self = this; |
152 | - if (self.data.is_agree){ | 167 | + if (self.data.is_agree) { |
153 | wx.requestPayment({ | 168 | wx.requestPayment({ |
154 | 'timeStamp': data.timeStamp, | 169 | 'timeStamp': data.timeStamp, |
155 | 'nonceStr': data.nonceStr, | 170 | 'nonceStr': data.nonceStr, |
156 | 'package': data.package, | 171 | 'package': data.package, |
157 | 'signType': 'MD5', | 172 | 'signType': 'MD5', |
158 | 'paySign': data.paySign, | 173 | 'paySign': data.paySign, |
159 | - 'success': function (res) { | 174 | + 'success': function(res) { |
160 | console.log(res) | 175 | console.log(res) |
161 | wx.showToast({ | 176 | wx.showToast({ |
162 | title: '支付成功', | 177 | title: '支付成功', |
163 | icon: 'success', | 178 | icon: 'success', |
164 | - success: function () { | ||
165 | - setTimeout(function () { | 179 | + success: function() { |
180 | + setTimeout(function() { | ||
166 | const params = { | 181 | const params = { |
167 | rule: self.data.rule, | 182 | rule: self.data.rule, |
168 | pay_info: self.data.pay_info, | 183 | pay_info: self.data.pay_info, |
169 | } | 184 | } |
170 | wx.navigateTo({ | 185 | wx.navigateTo({ |
171 | - url: '/pages/my/shareGroupBuy/shareGroupBuy?params=' + JSON.stringify(params), | 186 | + url: '/pages/my/shareGroupBuy/shareGroupBuy?params=' + JSON.stringify(params) + '&group_id=' + self.data.group_id, |
172 | }) | 187 | }) |
173 | }, 500) | 188 | }, 500) |
174 | } | 189 | } |
175 | }); | 190 | }); |
176 | }, | 191 | }, |
177 | - 'fail': function (res) { } | 192 | + 'fail': function(res) {} |
178 | }) | 193 | }) |
179 | - }else{ | 194 | + } else { |
180 | wx.showToast({ | 195 | wx.showToast({ |
181 | title: '请同意服务协议', | 196 | title: '请同意服务协议', |
182 | - icon:'none' | 197 | + icon: 'none' |
183 | }) | 198 | }) |
184 | } | 199 | } |
185 | 200 |
@@ -100,12 +100,9 @@ | @@ -100,12 +100,9 @@ | ||
100 | </view> | 100 | </view> |
101 | </view> | 101 | </view> |
102 | <view class='list_tab list_content' wx:for='{{recordList}}' wx:key=''> | 102 | <view class='list_tab list_content' wx:for='{{recordList}}' wx:key=''> |
103 | - <view class='list_tab_item' wx:if="{{item.group_status == 1}}">{{item.complete_time}}</view> | ||
104 | - <view class='list_tab_item' wx:if="{{item.group_status == 0}}">{{item.over_time}}</view> | ||
105 | - <view class='list_tab_item'>{{item.group_status == 1?'已完成':'未完成'}}</view> | ||
106 | - <view class='list_tab_item'> | ||
107 | - <text selectable='true' bindlongtap='copy'>{{chargenum}}</text> | ||
108 | - </view> | 103 | + <view class='list_tab_item'>{{item.create_time}}</view> |
104 | + <view class='list_tab_item'>{{item.is_used == 1?'已完成':'未完成'}}</view> | ||
105 | + <view class='list_tab_item' selectable='true' bindlongtap='copy'>{{item.redeem_code}}</view> | ||
109 | </view> | 106 | </view> |
110 | </view> | 107 | </view> |
111 | </view> | 108 | </view> |
@@ -137,7 +134,7 @@ | @@ -137,7 +134,7 @@ | ||
137 | </view> | 134 | </view> |
138 | <view class='service_btn_box'> | 135 | <view class='service_btn_box'> |
139 | <view>单价:¥{{pay_info.price}}</view> | 136 | <view>单价:¥{{pay_info.price}}</view> |
140 | - <view class='pay_btn' bindtap='goPay'>支付</view> | 137 | + <view class='pay_btn' bindtap='goPay' data-id='{{pay_info.id}}'>支付</view> |
141 | </view> | 138 | </view> |
142 | </view> | 139 | </view> |
143 | </view> | 140 | </view> |
1 | // pages/groupBuyDetail/groupBuyDetail.js | 1 | // pages/groupBuyDetail/groupBuyDetail.js |
2 | -const app=getApp() | 2 | +const app = getApp() |
3 | Page({ | 3 | Page({ |
4 | 4 | ||
5 | /** | 5 | /** |
@@ -8,9 +8,10 @@ Page({ | @@ -8,9 +8,10 @@ Page({ | ||
8 | data: { | 8 | data: { |
9 | isFolded: true, | 9 | isFolded: true, |
10 | imgUrls: ['../../../images/img1.png', '../../../images/img1.png', '../../../images/img1.png', '../../../images/img1.png', '../../../images/img1.png', '../../../images/img1.png', '../../../images/img1.png', '../../../images/img1.png', '../../../images/img1.png'], | 10 | imgUrls: ['../../../images/img1.png', '../../../images/img1.png', '../../../images/img1.png', '../../../images/img1.png', '../../../images/img1.png', '../../../images/img1.png', '../../../images/img1.png', '../../../images/img1.png', '../../../images/img1.png'], |
11 | - id:'', | ||
12 | - list_info:{} | 11 | + id: '', |
12 | + list_info: {} | ||
13 | }, | 13 | }, |
14 | + | ||
14 | //查看全部 | 15 | //查看全部 |
15 | listMore(e) { | 16 | listMore(e) { |
16 | this.setData({ | 17 | this.setData({ |
@@ -18,27 +19,28 @@ Page({ | @@ -18,27 +19,28 @@ Page({ | ||
18 | }) | 19 | }) |
19 | }, | 20 | }, |
20 | 21 | ||
21 | - listDetail(){ | ||
22 | - let url ='/portal/Group/group_detail' | ||
23 | - let params={ | ||
24 | - id:this.data.id | 22 | + listDetail() { |
23 | + let url = '/portal/Group/group_detail' | ||
24 | + let params = { | ||
25 | + id: this.data.id | ||
25 | } | 26 | } |
26 | - let header={ | ||
27 | - "XX-Token":wx.getStorageSync('token') | 27 | + let header = { |
28 | + "XX-Token": wx.getStorageSync('token') | ||
28 | } | 29 | } |
29 | - app.post(url,params,header).then((res)=>{ | 30 | + app.post(url, params, header).then((res) => { |
30 | console.log(res) | 31 | console.log(res) |
31 | this.setData({ | 32 | this.setData({ |
32 | list_info: res.info | 33 | list_info: res.info |
33 | }) | 34 | }) |
34 | }) | 35 | }) |
35 | }, | 36 | }, |
37 | + | ||
36 | /** | 38 | /** |
37 | * 生命周期函数--监听页面加载 | 39 | * 生命周期函数--监听页面加载 |
38 | */ | 40 | */ |
39 | onLoad: function(options) { | 41 | onLoad: function(options) { |
40 | this.setData({ | 42 | this.setData({ |
41 | - id:options.id | 43 | + id: options.id |
42 | }) | 44 | }) |
43 | this.listDetail() | 45 | this.listDetail() |
44 | }, | 46 | }, |
@@ -88,18 +90,19 @@ Page({ | @@ -88,18 +90,19 @@ Page({ | ||
88 | /** | 90 | /** |
89 | * 用户点击右上角分享 | 91 | * 用户点击右上角分享 |
90 | */ | 92 | */ |
91 | - onShareAppMessage: function () { | 93 | + onShareAppMessage: function() { |
92 | let that = this; | 94 | let that = this; |
93 | - var id=wx.getStorageSync('id') | 95 | + var id = wx.getStorageSync('group_id') |
96 | + console.log(id) | ||
94 | // 设置菜单中的转发按钮触发转发事件时的转发内容 | 97 | // 设置菜单中的转发按钮触发转发事件时的转发内容 |
95 | var shareObj = { | 98 | var shareObj = { |
96 | title: '科学队长', // 默认是小程序的名称(可以写slogan等) | 99 | title: '科学队长', // 默认是小程序的名称(可以写slogan等) |
97 | path: '/pages/my/takeGroupBuy/takeGroupBuy?id=' + id, // 默认是当前页面,必须是以‘/’开头的完整路径 | 100 | path: '/pages/my/takeGroupBuy/takeGroupBuy?id=' + id, // 默认是当前页面,必须是以‘/’开头的完整路径 |
98 | imageUrl: '', //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4 | 101 | imageUrl: '', //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4 |
99 | - success: function (res) { | ||
100 | - if (res.errMsg == 'shareAppMessage:ok') { } | 102 | + success: function(res) { |
103 | + if (res.errMsg == 'shareAppMessage:ok') {} | ||
101 | }, | 104 | }, |
102 | - fail: function () { | 105 | + fail: function() { |
103 | // 转发失败之后的回调 | 106 | // 转发失败之后的回调 |
104 | if (res.errMsg == 'shareAppMessage:fail cancel') { | 107 | if (res.errMsg == 'shareAppMessage:fail cancel') { |
105 | // 用户取消转发 | 108 | // 用户取消转发 |
@@ -107,7 +110,7 @@ Page({ | @@ -107,7 +110,7 @@ Page({ | ||
107 | // 转发失败,其中 detail message 为详细失败信息 | 110 | // 转发失败,其中 detail message 为详细失败信息 |
108 | } | 111 | } |
109 | }, | 112 | }, |
110 | - complete: function () { | 113 | + complete: function() { |
111 | // 转发结束之后的回调(转发成不成功都会执行) | 114 | // 转发结束之后的回调(转发成不成功都会执行) |
112 | } | 115 | } |
113 | } | 116 | } |
@@ -5,74 +5,78 @@ Page({ | @@ -5,74 +5,78 @@ Page({ | ||
5 | * 页面的初始数据 | 5 | * 页面的初始数据 |
6 | */ | 6 | */ |
7 | data: { | 7 | data: { |
8 | - | 8 | + group_id:'' |
9 | }, | 9 | }, |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * 生命周期函数--监听页面加载 | 12 | * 生命周期函数--监听页面加载 |
13 | */ | 13 | */ |
14 | - onLoad: function (options) { | 14 | + onLoad: function(options) { |
15 | console.log('options', options); | 15 | console.log('options', options); |
16 | - this.setData({params: options.params?JSON.parse(options.params):''}) | 16 | + this.setData({ |
17 | + params: options.params ? JSON.parse(options.params) : '', | ||
18 | + group_id:options.group_id | ||
19 | + }) | ||
17 | }, | 20 | }, |
18 | 21 | ||
19 | /** | 22 | /** |
20 | * 生命周期函数--监听页面初次渲染完成 | 23 | * 生命周期函数--监听页面初次渲染完成 |
21 | */ | 24 | */ |
22 | - onReady: function () { | 25 | + onReady: function() { |
23 | 26 | ||
24 | }, | 27 | }, |
25 | 28 | ||
26 | /** | 29 | /** |
27 | * 生命周期函数--监听页面显示 | 30 | * 生命周期函数--监听页面显示 |
28 | */ | 31 | */ |
29 | - onShow: function () { | 32 | + onShow: function() { |
30 | 33 | ||
31 | }, | 34 | }, |
32 | 35 | ||
33 | /** | 36 | /** |
34 | * 生命周期函数--监听页面隐藏 | 37 | * 生命周期函数--监听页面隐藏 |
35 | */ | 38 | */ |
36 | - onHide: function () { | 39 | + onHide: function() { |
37 | 40 | ||
38 | }, | 41 | }, |
39 | 42 | ||
40 | /** | 43 | /** |
41 | * 生命周期函数--监听页面卸载 | 44 | * 生命周期函数--监听页面卸载 |
42 | */ | 45 | */ |
43 | - onUnload: function () { | 46 | + onUnload: function() { |
44 | 47 | ||
45 | }, | 48 | }, |
46 | 49 | ||
47 | /** | 50 | /** |
48 | * 页面相关事件处理函数--监听用户下拉动作 | 51 | * 页面相关事件处理函数--监听用户下拉动作 |
49 | */ | 52 | */ |
50 | - onPullDownRefresh: function () { | 53 | + onPullDownRefresh: function() { |
51 | 54 | ||
52 | }, | 55 | }, |
53 | 56 | ||
54 | /** | 57 | /** |
55 | * 页面上拉触底事件的处理函数 | 58 | * 页面上拉触底事件的处理函数 |
56 | */ | 59 | */ |
57 | - onReachBottom: function () { | 60 | + onReachBottom: function() { |
58 | 61 | ||
59 | }, | 62 | }, |
60 | 63 | ||
61 | /** | 64 | /** |
62 | * 用户点击右上角分享 | 65 | * 用户点击右上角分享 |
63 | */ | 66 | */ |
64 | - onShareAppMessage: function () { | 67 | + onShareAppMessage: function() { |
65 | let that = this; | 68 | let that = this; |
66 | - var id=wx.getStorageSync('id') | 69 | + // var group_id = wx.getStorageSync('group_id') |
70 | + var group_id = this.data.group_id | ||
67 | // 设置菜单中的转发按钮触发转发事件时的转发内容 | 71 | // 设置菜单中的转发按钮触发转发事件时的转发内容 |
68 | var shareObj = { | 72 | var shareObj = { |
69 | title: '科学队长', // 默认是小程序的名称(可以写slogan等) | 73 | title: '科学队长', // 默认是小程序的名称(可以写slogan等) |
70 | - path: '/pages/my/takeGroupBuy/takeGroupBuy?id=' + id, // 默认是当前页面,必须是以‘/’开头的完整路径 | 74 | + path: '/pages/my/takeGroupBuy/takeGroupBuy?group_id=' + group_id, // 默认是当前页面,必须是以‘/’开头的完整路径 |
71 | imageUrl: '', //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4 | 75 | imageUrl: '', //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4 |
72 | - success: function (res) { | ||
73 | - if (res.errMsg == 'shareAppMessage:ok') { } | 76 | + success: function(res) { |
77 | + if (res.errMsg == 'shareAppMessage:ok') {} | ||
74 | }, | 78 | }, |
75 | - fail: function () { | 79 | + fail: function() { |
76 | // 转发失败之后的回调 | 80 | // 转发失败之后的回调 |
77 | if (res.errMsg == 'shareAppMessage:fail cancel') { | 81 | if (res.errMsg == 'shareAppMessage:fail cancel') { |
78 | // 用户取消转发 | 82 | // 用户取消转发 |
@@ -80,7 +84,7 @@ Page({ | @@ -80,7 +84,7 @@ Page({ | ||
80 | // 转发失败,其中 detail message 为详细失败信息 | 84 | // 转发失败,其中 detail message 为详细失败信息 |
81 | } | 85 | } |
82 | }, | 86 | }, |
83 | - complete: function () { | 87 | + complete: function() { |
84 | // 转发结束之后的回调(转发成不成功都会执行) | 88 | // 转发结束之后的回调(转发成不成功都会执行) |
85 | } | 89 | } |
86 | } | 90 | } |
1 | // pages/my/takeGroupBuy/takeGroupBuy.js | 1 | // pages/my/takeGroupBuy/takeGroupBuy.js |
2 | +const app=getApp() | ||
2 | Page({ | 3 | Page({ |
3 | 4 | ||
4 | /** | 5 | /** |
5 | * 页面的初始数据 | 6 | * 页面的初始数据 |
6 | */ | 7 | */ |
7 | data: { | 8 | data: { |
9 | + group_info: "", | ||
10 | + take_info:'', | ||
11 | + is_agree:false, | ||
12 | + rule:'', | ||
13 | + group_id:'' | ||
14 | + }, | ||
15 | + | ||
16 | + | ||
17 | + //查看详情 | ||
18 | + listDetail(e) { | ||
19 | + var id = e.currentTarget.dataset.id | ||
20 | + // wx.setStorageSync('id', id) | ||
21 | + wx.navigateTo({ | ||
22 | + url: '/pages/my/groupBuyDetail/groupBuyDetail?id=' + id, | ||
23 | + }) | ||
24 | + }, | ||
25 | + | ||
26 | + //参与的组团 | ||
27 | + takeGroup() { | ||
28 | + var that=this | ||
29 | + let url = '/portal/Group/group_detail' | ||
30 | + let params = { | ||
31 | + // id: wx.getStorageSync('group_id') | ||
32 | + id: this.data.group_id | ||
33 | + } | ||
34 | + let header = { | ||
35 | + "XX-Token": wx.getStorageSync('token') | ||
36 | + } | ||
37 | + app.post(url, params, header).then((res) => { | ||
38 | + console.log(res) | ||
39 | + that.setData({ | ||
40 | + group_info: res.info | ||
41 | + }) | ||
42 | + }) | ||
43 | + }, | ||
44 | + //团购规则 | ||
45 | + getRule() { | ||
46 | + let url = '/wxapp/public/arc_group' | ||
47 | + let params = {} | ||
48 | + let header = { | ||
49 | + "XX-Token": wx.getStorageSync('token') | ||
50 | + } | ||
51 | + app.post(url, {}, {}).then((res) => { | ||
52 | + console.log('团购规则', res) | ||
53 | + this.setData({ | ||
54 | + rule: res | ||
55 | + }) | ||
56 | + }) | ||
57 | + }, | ||
58 | + | ||
59 | + //发起团购 | ||
60 | + goPay() { | ||
61 | + let url = '/portal/Group/group_join' | ||
62 | + let params = { | ||
63 | + // id: wx.getStorageSync('group_id') | ||
64 | + id: this.data.group_id | ||
65 | + } | ||
66 | + let header = { | ||
67 | + "XX-Token": wx.getStorageSync('token') | ||
68 | + } | ||
69 | + app.post(url, params, header).then((res) => { | ||
70 | + console.log(res) | ||
71 | + this.setData({ | ||
72 | + take_info: res.info | ||
73 | + }) | ||
74 | + this.wxPay(res.pay) | ||
75 | + }) | ||
76 | + }, | ||
77 | + | ||
78 | + //发起团购支付 | ||
79 | + wxPay(data) { | ||
80 | + const self = this; | ||
81 | + if (self.data.is_agree) { | ||
82 | + wx.requestPayment({ | ||
83 | + 'timeStamp': data.timeStamp, | ||
84 | + 'nonceStr': data.nonceStr, | ||
85 | + 'package': data.package, | ||
86 | + 'signType': 'MD5', | ||
87 | + 'paySign': data.paySign, | ||
88 | + 'success': function(res) { | ||
89 | + console.log(res) | ||
90 | + wx.showToast({ | ||
91 | + title: '支付成功', | ||
92 | + icon: 'success', | ||
93 | + success: function() { | ||
94 | + setTimeout(function() { | ||
95 | + const params = { | ||
96 | + rule: self.data.rule, | ||
97 | + pay_info: self.data.pay_info, | ||
98 | + } | ||
99 | + wx.navigateTo({ | ||
100 | + url: '/pages/my/groupBuy/groupBuy', | ||
101 | + }) | ||
102 | + }, 500) | ||
103 | + } | ||
104 | + }); | ||
105 | + }, | ||
106 | + 'fail': function(res) {} | ||
107 | + }) | ||
108 | + } else { | ||
109 | + wx.showToast({ | ||
110 | + title: '请同意服务协议', | ||
111 | + icon: 'none' | ||
112 | + }) | ||
113 | + } | ||
114 | + }, | ||
115 | + | ||
116 | + //同意协议按钮 | ||
117 | + agree() { | ||
118 | + this.setData({ | ||
119 | + is_agree: !this.data.is_agree | ||
120 | + }) | ||
121 | + }, | ||
8 | 122 | ||
123 | + //服务协议 | ||
124 | + serviceProtocol() { | ||
125 | + wx.navigateTo({ | ||
126 | + url: '/pages/my/protocol/protocol', | ||
127 | + }) | ||
9 | }, | 128 | }, |
10 | 129 | ||
130 | + | ||
11 | /** | 131 | /** |
12 | * 生命周期函数--监听页面加载 | 132 | * 生命周期函数--监听页面加载 |
13 | */ | 133 | */ |
14 | - onLoad: function (options) { | ||
15 | - | 134 | + onLoad: function(options) { |
135 | + console.log(options.group_id) | ||
136 | + this.setData({ | ||
137 | + group_id: options.group_id | ||
138 | + }) | ||
139 | + // if (options.group_id !== '' || options.group_id!=undefined){ | ||
140 | + this.takeGroup() | ||
141 | + // } | ||
142 | + this.getRule() | ||
16 | }, | 143 | }, |
17 | 144 | ||
18 | /** | 145 | /** |
19 | * 生命周期函数--监听页面初次渲染完成 | 146 | * 生命周期函数--监听页面初次渲染完成 |
20 | */ | 147 | */ |
21 | - onReady: function () { | 148 | + onReady: function() { |
22 | 149 | ||
23 | }, | 150 | }, |
24 | 151 | ||
25 | /** | 152 | /** |
26 | * 生命周期函数--监听页面显示 | 153 | * 生命周期函数--监听页面显示 |
27 | */ | 154 | */ |
28 | - onShow: function () { | 155 | + onShow: function() { |
29 | 156 | ||
30 | }, | 157 | }, |
31 | 158 | ||
32 | /** | 159 | /** |
33 | * 生命周期函数--监听页面隐藏 | 160 | * 生命周期函数--监听页面隐藏 |
34 | */ | 161 | */ |
35 | - onHide: function () { | 162 | + onHide: function() { |
36 | 163 | ||
37 | }, | 164 | }, |
38 | 165 | ||
39 | /** | 166 | /** |
40 | * 生命周期函数--监听页面卸载 | 167 | * 生命周期函数--监听页面卸载 |
41 | */ | 168 | */ |
42 | - onUnload: function () { | 169 | + onUnload: function() { |
43 | 170 | ||
44 | }, | 171 | }, |
45 | 172 | ||
46 | /** | 173 | /** |
47 | * 页面相关事件处理函数--监听用户下拉动作 | 174 | * 页面相关事件处理函数--监听用户下拉动作 |
48 | */ | 175 | */ |
49 | - onPullDownRefresh: function () { | 176 | + onPullDownRefresh: function() { |
50 | 177 | ||
51 | }, | 178 | }, |
52 | 179 | ||
53 | /** | 180 | /** |
54 | * 页面上拉触底事件的处理函数 | 181 | * 页面上拉触底事件的处理函数 |
55 | */ | 182 | */ |
56 | - onReachBottom: function () { | 183 | + onReachBottom: function() { |
57 | 184 | ||
58 | }, | 185 | }, |
59 | 186 | ||
60 | /** | 187 | /** |
61 | * 用户点击右上角分享 | 188 | * 用户点击右上角分享 |
62 | */ | 189 | */ |
63 | - onShareAppMessage: function () { | 190 | + onShareAppMessage: function() { |
64 | 191 | ||
65 | } | 192 | } |
66 | }) | 193 | }) |
@@ -5,13 +5,13 @@ | @@ -5,13 +5,13 @@ | ||
5 | 5 | ||
6 | <view class='content_box'> | 6 | <view class='content_box'> |
7 | <view> | 7 | <view> |
8 | - <view class='item_list' wx:for='{{groupList}}' wx:key=''> | ||
9 | - <view class='list_title_box' data-id='{{item.id}}' bindtap='listDetail'> | 8 | + <view class='item_list'> |
9 | + <view class='list_title_box' data-id='{{group_info.id}}' bindtap='listDetail'> | ||
10 | <view>查看详情</view> | 10 | <view>查看详情</view> |
11 | <view class='iconfont icon-fanhui'></view> | 11 | <view class='iconfont icon-fanhui'></view> |
12 | </view> | 12 | </view> |
13 | <view class='list_info_box'> | 13 | <view class='list_info_box'> |
14 | - <block wx:for='{{item.group_detail}}' wx:for-item='sub_item' wx:key=''> | 14 | + <block wx:for='{{group_info.group_detail}}' wx:for-item='sub_item' wx:key=''> |
15 | <view class='info_item'> | 15 | <view class='info_item'> |
16 | <view class='info_box'> | 16 | <view class='info_box'> |
17 | <block> | 17 | <block> |
@@ -49,26 +49,26 @@ | @@ -49,26 +49,26 @@ | ||
49 | </view> --> | 49 | </view> --> |
50 | </view> | 50 | </view> |
51 | <view class='list_info'>成团人数:最低 | 51 | <view class='list_info'>成团人数:最低 |
52 | - <text>{{item.num}}</text>人,已参与: | ||
53 | - <text>{{item.count}}</text> 人,快呼唤伙伴参与吧!</view> | 52 | + <text>{{group_info.num}}</text>人,已参与: |
53 | + <text>{{group_info.count}}</text> 人,快呼唤伙伴参与吧!</view> | ||
54 | <view class='list_info'> | 54 | <view class='list_info'> |
55 | <view class='list_info_item'>剩余 | 55 | <view class='list_info_item'>剩余 |
56 | - <text>{{item.surplus_time}}</text> 结束</view> | 56 | + <text>{{group_info.surplus_time}}</text> 结束</view> |
57 | </view> | 57 | </view> |
58 | <view> | 58 | <view> |
59 | <view class='user_info_box'> | 59 | <view class='user_info_box'> |
60 | <view class='user_info'> | 60 | <view class='user_info'> |
61 | <view class='info_box'> | 61 | <view class='info_box'> |
62 | - <image src='{{item.avatar}}'></image> | 62 | + <image src='{{group_info.avatar}}'></image> |
63 | <view class='info_label'>发起人</view> | 63 | <view class='info_label'>发起人</view> |
64 | </view> | 64 | </view> |
65 | - <view>{{item.user_nickname}}</view> | 65 | + <view>{{group_info.user_nickname}}</view> |
66 | </view> | 66 | </view> |
67 | <view class='state_box'> | 67 | <view class='state_box'> |
68 | - <view>{{item.start_time}}开团</view> | ||
69 | - <view class='info_state' wx:if='{{item.group_status==1}}'>团购中</view> | ||
70 | - <view class='info_state' wx:if='{{item.group_status==2}}'>团购失败</view> | ||
71 | - <view class='info_state' wx:if='{{item.group_status==3}}'>团购成功</view> | 68 | + <view>{{group_info.start_time}}开团</view> |
69 | + <view class='info_state' wx:if='{{group_info.group_status==1}}'>团购中</view> | ||
70 | + <view class='info_state' wx:if='{{group_info.group_status==2}}'>团购失败</view> | ||
71 | + <view class='info_state' wx:if='{{group_info.group_status==3}}'>团购成功</view> | ||
72 | </view> | 72 | </view> |
73 | </view> | 73 | </view> |
74 | </view> | 74 | </view> |
@@ -78,25 +78,25 @@ | @@ -78,25 +78,25 @@ | ||
78 | <view class='list_title_info'> | 78 | <view class='list_title_info'> |
79 | <view class='iconfont icon-zhongdian'> </view> | 79 | <view class='iconfont icon-zhongdian'> </view> |
80 | <view> | 80 | <view> |
81 | - <view>团购规则说明</view> | ||
82 | - <view class='content_info'>如果因为环境网络问题或者其他原因导致无法打卡,请上传照 片及文字申诉内容,证明您已到场并已经参与活动。</view> | 81 | + <view>{{rule.title}}</view> |
82 | + <view class='content_info'>{{rule.description}}</view> | ||
83 | </view> | 83 | </view> |
84 | </view> | 84 | </view> |
85 | <view class='service_box'> | 85 | <view class='service_box'> |
86 | - <view class='service_info_box'> | ||
87 | - <text class='iconfont icon-xuanzhong'></text> | 86 | + <view class='service_info_box' bindtap="agree"> |
87 | + <text class='iconfont icon-xuanze1' wx:if="{{!is_agree}}"></text> | ||
88 | + <text class='iconfont icon-xuanzhong' wx:if="{{is_agree}}"></text> | ||
88 | <text>服务协议</text> | 89 | <text>服务协议</text> |
89 | - <!-- <text class='service_info' bindtap='serviceProtocol'>服务协议</text> --> | 90 | + <text class='service_info' catchtap='serviceProtocol'>服务协议</text> |
90 | </view> | 91 | </view> |
91 | <view class='service_btn_box'> | 92 | <view class='service_btn_box'> |
92 | - <view>单价:¥188.00</view> | 93 | + <view>单价:¥{{take_info.price}}</view> |
93 | <view class='pay_btn' bindtap='goPay'>参与并支付</view> | 94 | <view class='pay_btn' bindtap='goPay'>参与并支付</view> |
94 | </view> | 95 | </view> |
95 | </view> | 96 | </view> |
96 | 97 | ||
97 | - <view class='null_box'></view> | 98 | + <!-- <view class='null_box'></view> --> |
98 | <!-- <view class='bottom_box'> | 99 | <!-- <view class='bottom_box'> |
99 | <text class='iconfont icon-fenxiang'></text> 分享的文案,50汉字以内提示分享的文案,50汉字以内提示分 享的文案,50汉字以内 | 100 | <text class='iconfont icon-fenxiang'></text> 分享的文案,50汉字以内提示分享的文案,50汉字以内提示分 享的文案,50汉字以内 |
100 | </view> --> | 101 | </view> --> |
101 | </view> | 102 | </view> |
102 | - |
@@ -36,12 +36,19 @@ | @@ -36,12 +36,19 @@ | ||
36 | "list": [] | 36 | "list": [] |
37 | }, | 37 | }, |
38 | "miniprogram": { | 38 | "miniprogram": { |
39 | - "current": 0, | 39 | + "current": 1, |
40 | "list": [ | 40 | "list": [ |
41 | { | 41 | { |
42 | "id": -1, | 42 | "id": -1, |
43 | "name": "card", | 43 | "name": "card", |
44 | - "pathName": "pages/my/myCard/myCard" | 44 | + "pathName": "pages/my/myCard/myCard", |
45 | + "query": "" | ||
46 | + }, | ||
47 | + { | ||
48 | + "id": -1, | ||
49 | + "name": "card", | ||
50 | + "pathName": "pages/my/takeGroupBuy/takeGroupBuy", | ||
51 | + "query": "group_id=60" | ||
45 | } | 52 | } |
46 | ] | 53 | ] |
47 | } | 54 | } |
-
请 注册 或 登录 后发表评论