Commit 88c6243351bc7a0a8a297de3a1fa6e7b75c23bcc
1 parent
af247a8c
1 预存充值的推送消息
2. 积分购买的推送消息
Showing
4 changed files
with
145 additions
and
40 deletions
packageA/pages/chongzhiDetails/chongzhiDetails.js
| ... | ... | @@ -31,6 +31,23 @@ Page({ |
| 31 | 31 | getApp().goto("/pages/togoin/togoin"); |
| 32 | 32 | return false; |
| 33 | 33 | } |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + getApp().request.get("/api/wx/weappSendlist/page", { | |
| 38 | + data: { | |
| 39 | + store_id: os.stoid, | |
| 40 | + typeid: "1002" | |
| 41 | + }, | |
| 42 | + success: function(res) { | |
| 43 | + if (res.data.code == 0 && res.data.data.pageData.length > 0) { | |
| 44 | + var template_id = res.data.data.pageData[0].template_id; | |
| 45 | + self.setData({template_id:template_id}); | |
| 46 | + | |
| 47 | + } | |
| 48 | + }, | |
| 49 | + }) | |
| 50 | + | |
| 34 | 51 | |
| 35 | 52 | getApp().request.promiseGet("/api/weshop/ad/list",{ |
| 36 | 53 | data:{store_id:os.stoid,enabled:1,pid:601} |
| ... | ... | @@ -113,7 +130,11 @@ Page({ |
| 113 | 130 | |
| 114 | 131 | var money = e.target.dataset.money; |
| 115 | 132 | var advance = e.target.dataset.advance; |
| 116 | - this.recharge(money, advance); | |
| 133 | + var th=this; | |
| 134 | + this.sendsm(function(){ | |
| 135 | + th.recharge(money, advance); | |
| 136 | + }) | |
| 137 | + | |
| 117 | 138 | }, |
| 118 | 139 | //确定接口 |
| 119 | 140 | async recharge(money, advancek) { |
| ... | ... | @@ -194,4 +215,20 @@ Page({ |
| 194 | 215 | } |
| 195 | 216 | }); |
| 196 | 217 | }, |
| 218 | + | |
| 219 | + //订阅消息提醒 | |
| 220 | + sendsm:function(func) | |
| 221 | + { | |
| 222 | + var template_id = this.data.template_id; | |
| 223 | + //授权订阅 | |
| 224 | + wx.requestSubscribeMessage({ | |
| 225 | + tmplIds: [template_id], | |
| 226 | + success(res) { | |
| 227 | + func(); | |
| 228 | + }, | |
| 229 | + fail(res) { | |
| 230 | + func(); | |
| 231 | + } | |
| 232 | + }) | |
| 233 | + }, | |
| 197 | 234 | }) |
| 198 | 235 | \ No newline at end of file | ... | ... |
packageA/pages/chongzhiDetails/chongzhiDetails.wxml
| ... | ... | @@ -36,7 +36,7 @@ |
| 36 | 36 | </view> |
| 37 | 37 | |
| 38 | 38 | <view class="btn-container"> |
| 39 | - <text wx:if="{{type==0}}" data-advance="{{result.Id}}" data-money="{{result.NewSum}}" | |
| 39 | + <text wx:if="{{type==0}}" data-advance="{{result.Id}}" data-money="{{result.BeginSum}}" | |
| 40 | 40 | class="btn" bindtap="go_buy">立即充值</text> |
| 41 | 41 | <block wx:else> |
| 42 | 42 | <text wx:if="{{result.AddType==0}}" class="btn" bindtap="onUse">立即使用</text> | ... | ... |
pages/user/deposit/prepaid/prepaid.js
| ... | ... | @@ -14,6 +14,21 @@ Page({ |
| 14 | 14 | }, |
| 15 | 15 | /* 生命周期函数--监听页面初次渲染完成*/ |
| 16 | 16 | onReady: function() { |
| 17 | + var th=this; | |
| 18 | + | |
| 19 | + getApp().request.get("/api/wx/weappSendlist/page", { | |
| 20 | + data: { | |
| 21 | + store_id: os.stoid, | |
| 22 | + typeid: "1002" | |
| 23 | + }, | |
| 24 | + success: function(res) { | |
| 25 | + if (res.data.code == 0 && res.data.data.pageData.length > 0) { | |
| 26 | + var template_id = res.data.data.pageData[0].template_id; | |
| 27 | + th.setData({template_id:template_id}); | |
| 28 | + } | |
| 29 | + } | |
| 30 | + }); | |
| 31 | + | |
| 17 | 32 | this.yuck(); |
| 18 | 33 | }, |
| 19 | 34 | /*预存款的劵*/ |
| ... | ... | @@ -73,6 +88,7 @@ Page({ |
| 73 | 88 | }, |
| 74 | 89 | //确定充值 |
| 75 | 90 | determine: function(e) { |
| 91 | + var th=this; | |
| 76 | 92 | this.setData({ |
| 77 | 93 | showModal: false |
| 78 | 94 | }) |
| ... | ... | @@ -80,9 +96,11 @@ Page({ |
| 80 | 96 | var moneyone = e.target.dataset.moneyone; |
| 81 | 97 | var money = e.target.dataset.money; |
| 82 | 98 | var advancek = e.target.dataset.adv; |
| 83 | - //console.log(moneyone, "aaa", money); | |
| 84 | - | |
| 85 | - this.recharge(money, advancek); | |
| 99 | + | |
| 100 | + this.sendsm(function(){ | |
| 101 | + th.recharge(money, advancek); | |
| 102 | + }) | |
| 103 | + | |
| 86 | 104 | }, |
| 87 | 105 | //确定接口 |
| 88 | 106 | async recharge(money, advancek) { |
| ... | ... | @@ -172,5 +190,23 @@ Page({ |
| 172 | 190 | go_detail:function(e){ |
| 173 | 191 | var id=e.currentTarget.dataset.id; |
| 174 | 192 | getApp().goto('/packageA/pages/chongzhiDetails/chongzhiDetails?id=' + id); |
| 175 | - } | |
| 193 | + }, | |
| 194 | + | |
| 195 | + | |
| 196 | + //订阅消息提醒 | |
| 197 | + sendsm:function(func) | |
| 198 | + { | |
| 199 | + var template_id = this.data.template_id; | |
| 200 | + // //授权订阅 | |
| 201 | + wx.requestSubscribeMessage({ | |
| 202 | + tmplIds: [template_id], | |
| 203 | + success(res) { | |
| 204 | + func(); | |
| 205 | + }, | |
| 206 | + fail(res) { | |
| 207 | + func(); | |
| 208 | + } | |
| 209 | + }) | |
| 210 | + | |
| 211 | + }, | |
| 176 | 212 | }) | ... | ... |
pages/user/integral/integral.js
| ... | ... | @@ -192,6 +192,21 @@ Page({ |
| 192 | 192 | * 生命周期函数--监听页面加载 |
| 193 | 193 | */ |
| 194 | 194 | onLoad: function (options) { |
| 195 | + | |
| 196 | + var th=this; | |
| 197 | + getApp().request.get("/api/wx/weappSendlist/page", { | |
| 198 | + data: { | |
| 199 | + store_id: os.stoid, | |
| 200 | + typeid: "1002" | |
| 201 | + }, | |
| 202 | + success: function(res) { | |
| 203 | + if (res.data.code == 0 && res.data.data.pageData.length > 0) { | |
| 204 | + var template_id = res.data.data.pageData[0].template_id; | |
| 205 | + th.setData({template_id:template_id}); | |
| 206 | + } | |
| 207 | + } | |
| 208 | + }); | |
| 209 | + | |
| 195 | 210 | var th=this; |
| 196 | 211 | getApp().getConfig2(function(ee){ |
| 197 | 212 | var json_d = JSON.parse(ee.switch_list); |
| ... | ... | @@ -207,7 +222,7 @@ Page({ |
| 207 | 222 | }, |
| 208 | 223 | |
| 209 | 224 | //点击确定 |
| 210 | - async determine(event) { | |
| 225 | + determine(event) { | |
| 211 | 226 | console.log(event.currentTarget.dataset.money); |
| 212 | 227 | var money = event.currentTarget.dataset.money; |
| 213 | 228 | var integral = event.currentTarget.dataset.integral; |
| ... | ... | @@ -216,32 +231,38 @@ Page({ |
| 216 | 231 | var user_id = getApp().globalData.user_id; |
| 217 | 232 | var store_id = os.stoid; |
| 218 | 233 | var th= this, number; |
| 219 | - await getApp().request.promiseGet("/api/weshop/users/getPay" | |
| 220 | - , { | |
| 221 | - data: { user_id: user_id, store_id: store_id, buynum: val, mon: money, integ: integral, recharge_type:1} | |
| 222 | - }).then(res => { | |
| 223 | - // console.log("1" + res); | |
| 224 | - var msg = res.data.data; | |
| 225 | - var parentSn = msg.order_sn; | |
| 226 | - var store_id = os.stoid; | |
| 227 | - | |
| 228 | - getApp().request.post("/api/weshop/order/pay/createRechargeOrder", { | |
| 229 | - data: { | |
| 230 | - parentSn: parentSn, | |
| 231 | - store_id: store_id | |
| 232 | - }, | |
| 233 | - success: function (su) { | |
| 234 | - var n = su.data.data; | |
| 235 | - th.weixinPay(n, | |
| 236 | - function () { | |
| 237 | - console.log("支付成功页面2333"); | |
| 238 | - th.jumpPaymentPage(); | |
| 239 | - }, function () { | |
| 240 | - getApp().showWarning("支付失败"); | |
| 241 | - }) | |
| 242 | - } | |
| 243 | - }) | |
| 244 | - }) | |
| 234 | + | |
| 235 | + this.sendsm(function(){ | |
| 236 | + getApp().request.promiseGet("/api/weshop/users/getPay" | |
| 237 | + , { | |
| 238 | + data: { user_id: user_id, store_id: store_id, buynum: val, mon: money, integ: integral, recharge_type:1} | |
| 239 | + }).then(res => { | |
| 240 | + // console.log("1" + res); | |
| 241 | + var msg = res.data.data; | |
| 242 | + var parentSn = msg.order_sn; | |
| 243 | + var store_id = os.stoid; | |
| 244 | + | |
| 245 | + getApp().request.post("/api/weshop/order/pay/createRechargeOrder", { | |
| 246 | + data: { | |
| 247 | + parentSn: parentSn, | |
| 248 | + store_id: store_id | |
| 249 | + }, | |
| 250 | + success: function (su) { | |
| 251 | + var n = su.data.data; | |
| 252 | + th.weixinPay(n, | |
| 253 | + function () { | |
| 254 | + console.log("支付成功页面2333"); | |
| 255 | + th.jumpPaymentPage(); | |
| 256 | + }, function () { | |
| 257 | + getApp().showWarning("支付失败"); | |
| 258 | + }) | |
| 259 | + } | |
| 260 | + }) | |
| 261 | + }) | |
| 262 | + }) | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 245 | 266 | }, |
| 246 | 267 | //------支付成功页面-------- |
| 247 | 268 | jumpPaymentPage: function () { |
| ... | ... | @@ -299,12 +320,6 @@ Page({ |
| 299 | 320 | |
| 300 | 321 | }, |
| 301 | 322 | |
| 302 | - /** | |
| 303 | - * 生命周期函数--监听页面卸载 | |
| 304 | - */ | |
| 305 | - onUnload: function () { | |
| 306 | - | |
| 307 | - }, | |
| 308 | 323 | |
| 309 | 324 | /** |
| 310 | 325 | * 页面相关事件处理函数--监听用户下拉动作 |
| ... | ... | @@ -319,5 +334,22 @@ Page({ |
| 319 | 334 | */ |
| 320 | 335 | onShareAppMessage: function () { |
| 321 | 336 | |
| 322 | - } | |
| 337 | + }, | |
| 338 | + | |
| 339 | + //订阅消息提醒 | |
| 340 | + sendsm:function(func) | |
| 341 | + { | |
| 342 | + var template_id = this.data.template_id; | |
| 343 | + // //授权订阅 | |
| 344 | + wx.requestSubscribeMessage({ | |
| 345 | + tmplIds: [template_id], | |
| 346 | + success(res) { | |
| 347 | + func(); | |
| 348 | + }, | |
| 349 | + fail(res) { | |
| 350 | + func(); | |
| 351 | + } | |
| 352 | + }) | |
| 353 | + | |
| 354 | + }, | |
| 323 | 355 | }) |
| 324 | 356 | \ No newline at end of file | ... | ... |