Commit 317b55b89055c27d447394b5707b0e11664776d8
1 parent
b50b8962
预约模板发送
Showing
3 changed files
with
55 additions
and
10 deletions
pages/user/my_service/appment_main.js
@@ -47,13 +47,29 @@ Page({ | @@ -47,13 +47,29 @@ Page({ | ||
47 | }, | 47 | }, |
48 | //控制备注输入 | 48 | //控制备注输入 |
49 | check_text: function() { | 49 | check_text: function() { |
50 | + wx.requestSubscribeMessage({ | ||
51 | + tmplIds: ['Jg7Tj-wPlDfsairz_EHBQdoQnzLLF4nVhT1weCBEmTE'], | ||
52 | + success(res) { | ||
53 | + console.log("222222222222222222222222222222"); | ||
54 | + }, | ||
55 | + | ||
56 | + fail(res) { | ||
57 | + | ||
58 | + console.log('fail 失败') | ||
59 | + | ||
60 | + console.log(res) | ||
61 | + | ||
62 | + logger.warn('订阅消息fail', res) | ||
63 | + | ||
64 | + } | ||
65 | + }) | ||
66 | + | ||
50 | var th = this; | 67 | var th = this; |
51 | var is_textea = th.data.is_textea; | 68 | var is_textea = th.data.is_textea; |
52 | th.setData({ | 69 | th.setData({ |
53 | is_textea: 1, | 70 | is_textea: 1, |
54 | beautician: 0 | 71 | beautician: 0 |
55 | }) | 72 | }) |
56 | - | ||
57 | }, | 73 | }, |
58 | onclickstore: function() { | 74 | onclickstore: function() { |
59 | var th = this; | 75 | var th = this; |
@@ -82,13 +98,12 @@ Page({ | @@ -82,13 +98,12 @@ Page({ | ||
82 | remarks: remarks | 98 | remarks: remarks |
83 | }) | 99 | }) |
84 | }, | 100 | }, |
85 | - //提交预约 | ||
86 | - sub_success: function(e) { | 101 | + //提交成功及发送模版代码 |
102 | + success: function() { | ||
87 | var th = this; | 103 | var th = this; |
88 | th.setData({ | 104 | th.setData({ |
89 | is_textea: 0 | 105 | is_textea: 0 |
90 | }) | 106 | }) |
91 | - var formid = e.detail.formId; //发送预约成功模版信息 | ||
92 | var store = th.data.store_name; //门店名称 | 107 | var store = th.data.store_name; //门店名称 |
93 | var bea_name = th.data.beautician_name; //美容师名称 | 108 | var bea_name = th.data.beautician_name; //美容师名称 |
94 | var time = th.data.time; //预约时间 | 109 | var time = th.data.time; //预约时间 |
@@ -149,11 +164,11 @@ Page({ | @@ -149,11 +164,11 @@ Page({ | ||
149 | getApp().my_warnning("预约成功", 1, th); | 164 | getApp().my_warnning("预约成功", 1, th); |
150 | var store_name = th.data.store_name; //预约门店 | 165 | var store_name = th.data.store_name; //预约门店 |
151 | var number = res.data.data.Number; | 166 | var number = res.data.data.Number; |
152 | - var temp_url = "/api/wx/open/app/user/templatMessageSend"; //模版接口 | 167 | + var temp_url = "/api/wx/open/app/user/sendSubscribeMsg"; //模版接口 |
153 | var userinfo = getApp().globalData.userInfo; | 168 | var userinfo = getApp().globalData.userInfo; |
154 | var name = d.userInfo.nickname; | 169 | var name = d.userInfo.nickname; |
155 | var json = { | 170 | var json = { |
156 | - "formId": formid, | 171 | + // "formId": formid, |
157 | "keyWord": [{ | 172 | "keyWord": [{ |
158 | "keyword": res.data.data.ServiceName | 173 | "keyword": res.data.data.ServiceName |
159 | }, | 174 | }, |
@@ -199,10 +214,41 @@ Page({ | @@ -199,10 +214,41 @@ Page({ | ||
199 | } | 214 | } |
200 | } | 215 | } |
201 | }, | 216 | }, |
217 | + //提交预约 | ||
218 | + sub_success: function(e) { | ||
219 | + var th = this; | ||
220 | + var temp_url = "/api/wx/weappSendlist/page"; | ||
221 | + var template_id = ""; | ||
222 | + //获取模版id | ||
223 | + getApp().request.promiseGet(temp_url, { | ||
224 | + data: { | ||
225 | + store_id: a.stoid, | ||
226 | + typeid: "1011" | ||
227 | + } | ||
228 | + }).then(res => { | ||
229 | + if (res.data.code == 0) { | ||
230 | + template_id = res.data.data.pageData[0].template_id; | ||
231 | + // //授权订阅 | ||
232 | + wx.requestSubscribeMessage({ | ||
233 | + tmplIds: [template_id], | ||
234 | + success(res) { | ||
235 | + th.success(); | ||
236 | + }, | ||
237 | + fail(res) { | ||
238 | + th.success(); | ||
239 | + } | ||
240 | + }) | ||
241 | + }else{ | ||
242 | + th.success(); | ||
243 | + } | ||
244 | + }) | ||
245 | + | ||
246 | + }, | ||
202 | goto: function(e) { | 247 | goto: function(e) { |
203 | var th = this; | 248 | var th = this; |
204 | th.setData({ | 249 | th.setData({ |
205 | - beautician: 0 | 250 | + beautician: 0, |
251 | + is_textea: 0 | ||
206 | }) | 252 | }) |
207 | if (th.data.store_name == "") { | 253 | if (th.data.store_name == "") { |
208 | getApp().my_warnning("请选择服务门店", 0, th); | 254 | getApp().my_warnning("请选择服务门店", 0, th); |
pages/user/my_service/appment_main.wxml
@@ -68,7 +68,7 @@ | @@ -68,7 +68,7 @@ | ||
68 | <view>备</view> | 68 | <view>备</view> |
69 | <view>注</view> | 69 | <view>注</view> |
70 | </view> | 70 | </view> |
71 | - <view class="flex fs26" bindtap=""> | 71 | + <view class="flex fs26"> |
72 | <block wx:if="{{is_textea==1 && store==0}}"> | 72 | <block wx:if="{{is_textea==1 && store==0}}"> |
73 | <textarea class="textarea" placeholder="{{remarks==''?'填写备注':remarks}}" placeholder-class="fs26 color" value="{{remarks}}" bindinput="input_remarks" maxlength="100"> | 73 | <textarea class="textarea" placeholder="{{remarks==''?'填写备注':remarks}}" placeholder-class="fs26 color" value="{{remarks}}" bindinput="input_remarks" maxlength="100"> |
74 | </textarea> | 74 | </textarea> |
@@ -87,7 +87,7 @@ | @@ -87,7 +87,7 @@ | ||
87 | <navigator class="appment flex-center" url="/pages/user/my_service/tment_order_list"> | 87 | <navigator class="appment flex-center" url="/pages/user/my_service/tment_order_list"> |
88 | <view>我的预约</view> | 88 | <view>我的预约</view> |
89 | </navigator> | 89 | </navigator> |
90 | - <form report-submit='true' bindsubmit="sub_success"> | 90 | + <form report-submit='true' bindtap="sub_success"> |
91 | <button form-type="submit" class="sub_appment flex-center"> | 91 | <button form-type="submit" class="sub_appment flex-center"> |
92 | <view>提交预约</view> | 92 | <view>提交预约</view> |
93 | </button> | 93 | </button> |
pages/user/my_service/i_service.js
@@ -32,7 +32,6 @@ Page({ | @@ -32,7 +32,6 @@ Page({ | ||
32 | var userinfo = getApp().globalData.userInfo; | 32 | var userinfo = getApp().globalData.userInfo; |
33 | if (userinfo == null) { | 33 | if (userinfo == null) { |
34 | //界面必须使用warn 做ID,并调用 | 34 | //界面必须使用warn 做ID,并调用 |
35 | - getApp().my_warnning("会员为空", 0, this); | ||
36 | return false; | 35 | return false; |
37 | } | 36 | } |
38 | this.setData({ | 37 | this.setData({ |