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 | 47 | }, |
48 | 48 | //控制备注输入 |
49 | 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 | 67 | var th = this; |
51 | 68 | var is_textea = th.data.is_textea; |
52 | 69 | th.setData({ |
53 | 70 | is_textea: 1, |
54 | 71 | beautician: 0 |
55 | 72 | }) |
56 | - | |
57 | 73 | }, |
58 | 74 | onclickstore: function() { |
59 | 75 | var th = this; |
... | ... | @@ -82,13 +98,12 @@ Page({ |
82 | 98 | remarks: remarks |
83 | 99 | }) |
84 | 100 | }, |
85 | - //提交预约 | |
86 | - sub_success: function(e) { | |
101 | + //提交成功及发送模版代码 | |
102 | + success: function() { | |
87 | 103 | var th = this; |
88 | 104 | th.setData({ |
89 | 105 | is_textea: 0 |
90 | 106 | }) |
91 | - var formid = e.detail.formId; //发送预约成功模版信息 | |
92 | 107 | var store = th.data.store_name; //门店名称 |
93 | 108 | var bea_name = th.data.beautician_name; //美容师名称 |
94 | 109 | var time = th.data.time; //预约时间 |
... | ... | @@ -149,11 +164,11 @@ Page({ |
149 | 164 | getApp().my_warnning("预约成功", 1, th); |
150 | 165 | var store_name = th.data.store_name; //预约门店 |
151 | 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 | 168 | var userinfo = getApp().globalData.userInfo; |
154 | 169 | var name = d.userInfo.nickname; |
155 | 170 | var json = { |
156 | - "formId": formid, | |
171 | + // "formId": formid, | |
157 | 172 | "keyWord": [{ |
158 | 173 | "keyword": res.data.data.ServiceName |
159 | 174 | }, |
... | ... | @@ -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 | 247 | goto: function(e) { |
203 | 248 | var th = this; |
204 | 249 | th.setData({ |
205 | - beautician: 0 | |
250 | + beautician: 0, | |
251 | + is_textea: 0 | |
206 | 252 | }) |
207 | 253 | if (th.data.store_name == "") { |
208 | 254 | getApp().my_warnning("请选择服务门店", 0, th); | ... | ... |
pages/user/my_service/appment_main.wxml
... | ... | @@ -68,7 +68,7 @@ |
68 | 68 | <view>备</view> |
69 | 69 | <view>注</view> |
70 | 70 | </view> |
71 | - <view class="flex fs26" bindtap=""> | |
71 | + <view class="flex fs26"> | |
72 | 72 | <block wx:if="{{is_textea==1 && store==0}}"> |
73 | 73 | <textarea class="textarea" placeholder="{{remarks==''?'填写备注':remarks}}" placeholder-class="fs26 color" value="{{remarks}}" bindinput="input_remarks" maxlength="100"> |
74 | 74 | </textarea> |
... | ... | @@ -87,7 +87,7 @@ |
87 | 87 | <navigator class="appment flex-center" url="/pages/user/my_service/tment_order_list"> |
88 | 88 | <view>我的预约</view> |
89 | 89 | </navigator> |
90 | - <form report-submit='true' bindsubmit="sub_success"> | |
90 | + <form report-submit='true' bindtap="sub_success"> | |
91 | 91 | <button form-type="submit" class="sub_appment flex-center"> |
92 | 92 | <view>提交预约</view> |
93 | 93 | </button> | ... | ... |