Commit 6192417378e0f5a969b1eb7daf838cd8a0cf0996
Merge branch 'dev' of http://git.vipzhuang.cn/wxd/MShopWeApp into dev
Showing
4 changed files
with
156 additions
and
130 deletions
pages/user/my_service/appment_main.js
@@ -47,23 +47,6 @@ Page({ | @@ -47,23 +47,6 @@ 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 | - | ||
67 | var th = this; | 50 | var th = this; |
68 | var is_textea = th.data.is_textea; | 51 | var is_textea = th.data.is_textea; |
69 | th.setData({ | 52 | th.setData({ |
@@ -77,11 +60,13 @@ Page({ | @@ -77,11 +60,13 @@ Page({ | ||
77 | if (store) { | 60 | if (store) { |
78 | th.setData({ | 61 | th.setData({ |
79 | store: 0, | 62 | store: 0, |
63 | + is_textea: 1 | ||
80 | }) | 64 | }) |
81 | } else { | 65 | } else { |
82 | th.setData({ | 66 | th.setData({ |
83 | beautician: 0, | 67 | beautician: 0, |
84 | store: 1, | 68 | store: 1, |
69 | + is_textea: 0 | ||
85 | }) | 70 | }) |
86 | if (th.data.store_list.length < 1) { | 71 | if (th.data.store_list.length < 1) { |
87 | wx.showLoading({ | 72 | wx.showLoading({ |
@@ -101,124 +86,141 @@ Page({ | @@ -101,124 +86,141 @@ Page({ | ||
101 | //提交成功及发送模版代码 | 86 | //提交成功及发送模版代码 |
102 | success: function() { | 87 | success: function() { |
103 | var th = this; | 88 | var th = this; |
104 | - th.setData({ | ||
105 | - is_textea: 0 | 89 | + var store = th.data.store_name; //门店名称 |
90 | + var bea_name = th.data.beautician_name; //美容师名称 | ||
91 | + var time = th.data.time; //预约时间 | ||
92 | + var is_sub = th.data.is_sub; //是否重复提交 | ||
93 | + wx.showLoading({ | ||
94 | + title: '加载中', | ||
106 | }) | 95 | }) |
96 | + var url = th.data.inurl + "/api/weshop/marketing/reservation/reservation/insert"; //接口路径 | ||
97 | + var serviceId = th.data.itemId; //服务id | ||
98 | + var beauticianID = th.data.beauticianID; //美容师id | ||
99 | + var buyType = th.data.buyType; //服务项目类型 | ||
100 | + var storeId = a.stoid; //商家id | ||
101 | + var storageId = th.data.storageId; //门店id | ||
102 | + var userId = d.user_id; //用户id | ||
103 | + var remarks = th.data.remarks; //用户备注 | ||
104 | + var project_id = th.data.project_id; //项目id | ||
105 | + var validay = th.data.validay; | ||
106 | + var json = { | ||
107 | + "arrangeTime": time + ":00", | ||
108 | + "beauticianId": beauticianID, | ||
109 | + "buyType": buyType, | ||
110 | + "effectiveDay": "", | ||
111 | + "number": "", | ||
112 | + "projectId": project_id, | ||
113 | + "remark": remarks, | ||
114 | + "serviceId": serviceId, | ||
115 | + "states": 0, | ||
116 | + "storageId": storageId, | ||
117 | + "storeId": storeId, | ||
118 | + "userId": userId, | ||
119 | + "validay": validay | ||
120 | + } | ||
121 | + var data = JSON.stringify(json); | ||
122 | + wx.request({ | ||
123 | + url: url, | ||
124 | + data: json, | ||
125 | + method: 'post', | ||
126 | + header: { | ||
127 | + 'content-type': 'application/json' | ||
128 | + }, // 设置请求的 header | ||
129 | + success: function(res) { | ||
130 | + th.setData({ | ||
131 | + is_sub: 0 | ||
132 | + }) | ||
133 | + wx.hideLoading(); | ||
134 | + if (res.data.code == 0) { | ||
135 | + getApp().my_warnning("预约成功", 1, th); | ||
136 | + var store_name = th.data.store_name; //预约门店 | ||
137 | + var number = res.data.data.Number; | ||
138 | + var temp_url = "/api/wx/open/app/user/sendSubscribeMsg"; //模版接口 | ||
139 | + var userinfo = getApp().globalData.userInfo; | ||
140 | + var name = d.userInfo.nickname; | ||
141 | + var json = { | ||
142 | + // "formId": formid, | ||
143 | + "keyWord": [{ | ||
144 | + "keyword": res.data.data.ServiceName | ||
145 | + }, | ||
146 | + { | ||
147 | + "keyword": time.substring(0, 16) | ||
148 | + }, { | ||
149 | + "keyword": res.data.data.BeauticianName | ||
150 | + }, { | ||
151 | + "keyword": res.data.data.StorageName | ||
152 | + }, { | ||
153 | + "keyword": res.data.data.Address | ||
154 | + } | ||
155 | + ], | ||
156 | + "page": "/pages/user/my_service/tment_details?number=" + number, | ||
157 | + "storeId": a.stoid, | ||
158 | + "typeId": "1011", | ||
159 | + "userId": d.user_id | ||
160 | + }; | ||
161 | + var data = JSON.stringify(json); | ||
162 | + //调用发送预约成功模版接口 | ||
163 | + wx.request({ | ||
164 | + url: th.data.inurl + temp_url, | ||
165 | + data: data, | ||
166 | + method: 'post', | ||
167 | + header: { | ||
168 | + 'content-type': 'application/json' | ||
169 | + }, // 设置请求的 header | ||
170 | + success: function(data) {} | ||
171 | + }) | ||
172 | + setTimeout(function() { | ||
173 | + wx.redirectTo({ | ||
174 | + url: "/pages/user/my_service/tment_details?number=" + number | ||
175 | + }); | ||
176 | + }, 1000); | ||
177 | + } else { | ||
178 | + getApp().my_warnning(res.data.msg, 0, th); | ||
179 | + th.settime(); | ||
180 | + } | ||
181 | + } | ||
182 | + }) | ||
183 | + | ||
184 | + }, | ||
185 | + //定时显示texteat | ||
186 | + settime: function() { | ||
187 | + var th = this; | ||
188 | + setTimeout(function() { | ||
189 | + th.setData({ | ||
190 | + is_textea: 1 | ||
191 | + }) | ||
192 | + }, 2000); | ||
193 | + }, | ||
194 | + //提交预约 | ||
195 | + sub_success: function(e) { | ||
196 | + var th = this; | ||
197 | + var temp_url = th.data.inurl + "/api/wx/weappSendlist/page"; | ||
198 | + var template_id = ""; | ||
199 | + if (th.data.is_sub == 1) { | ||
200 | + return false; | ||
201 | + } | ||
107 | var store = th.data.store_name; //门店名称 | 202 | var store = th.data.store_name; //门店名称 |
108 | var bea_name = th.data.beautician_name; //美容师名称 | 203 | var bea_name = th.data.beautician_name; //美容师名称 |
109 | var time = th.data.time; //预约时间 | 204 | var time = th.data.time; //预约时间 |
110 | var is_sub = th.data.is_sub; //是否重复提交 | 205 | var is_sub = th.data.is_sub; //是否重复提交 |
206 | + th.setData({ | ||
207 | + is_textea: 0, | ||
208 | + is_sub: 1 | ||
209 | + }) | ||
111 | //提交预约前的判断 | 210 | //提交预约前的判断 |
112 | if (store == "") { | 211 | if (store == "") { |
113 | getApp().my_warnning("请选择服务门店", 0, th); | 212 | getApp().my_warnning("请选择服务门店", 0, th); |
213 | + th.settime(); | ||
114 | return false; | 214 | return false; |
115 | } else if (bea_name == "") { | 215 | } else if (bea_name == "") { |
116 | getApp().my_warnning("请选择美容师", 0, th); | 216 | getApp().my_warnning("请选择美容师", 0, th); |
217 | + th.settime(); | ||
117 | return false; | 218 | return false; |
118 | } else if (time == "") { | 219 | } else if (time == "") { |
119 | getApp().my_warnning("请选择预约时间", 0, th); | 220 | getApp().my_warnning("请选择预约时间", 0, th); |
221 | + th.settime(); | ||
120 | return false; | 222 | return false; |
121 | - } else { | ||
122 | - if (is_sub == 0) { | ||
123 | - th.setData({ | ||
124 | - is_sub: 1 | ||
125 | - }) | ||
126 | - var url = th.data.inurl + "/api/weshop/marketing/reservation/reservation/insert"; //接口路径 | ||
127 | - var serviceId = th.data.itemId; //服务id | ||
128 | - var beauticianID = th.data.beauticianID; //美容师id | ||
129 | - var buyType = th.data.buyType; //服务项目类型 | ||
130 | - var storeId = a.stoid; //商家id | ||
131 | - var storageId = th.data.storageId; //门店id | ||
132 | - var userId = d.user_id; //用户id | ||
133 | - var remarks = th.data.remarks; //用户备注 | ||
134 | - var project_id = th.data.project_id; //项目id | ||
135 | - var validay = th.data.validay; | ||
136 | - var json = { | ||
137 | - "arrangeTime": time, | ||
138 | - "beauticianId": beauticianID, | ||
139 | - "buyType": buyType, | ||
140 | - "effectiveDay": "", | ||
141 | - "number": "", | ||
142 | - "projectId": project_id, | ||
143 | - "remark": remarks, | ||
144 | - "serviceId": serviceId, | ||
145 | - "states": 0, | ||
146 | - "storageId": storageId, | ||
147 | - "storeId": storeId, | ||
148 | - "userId": userId, | ||
149 | - "validay": validay | ||
150 | - } | ||
151 | - var data = JSON.stringify(json); | ||
152 | - wx.request({ | ||
153 | - url: url, | ||
154 | - data: json, | ||
155 | - method: 'post', | ||
156 | - header: { | ||
157 | - 'content-type': 'application/json' | ||
158 | - }, // 设置请求的 header | ||
159 | - success: function(res) { | ||
160 | - th.setData({ | ||
161 | - is_sub: 0 | ||
162 | - }) | ||
163 | - if (res.data.code == 0) { | ||
164 | - getApp().my_warnning("预约成功", 1, th); | ||
165 | - var store_name = th.data.store_name; //预约门店 | ||
166 | - var number = res.data.data.Number; | ||
167 | - var temp_url = "/api/wx/open/app/user/sendSubscribeMsg"; //模版接口 | ||
168 | - var userinfo = getApp().globalData.userInfo; | ||
169 | - var name = d.userInfo.nickname; | ||
170 | - var json = { | ||
171 | - // "formId": formid, | ||
172 | - "keyWord": [{ | ||
173 | - "keyword": res.data.data.ServiceName | ||
174 | - }, | ||
175 | - { | ||
176 | - "keyword": time | ||
177 | - }, { | ||
178 | - "keyword": res.data.data.BeauticianName | ||
179 | - }, { | ||
180 | - "keyword": res.data.data.StorageName | ||
181 | - }, { | ||
182 | - "keyword": res.data.data.Address | ||
183 | - } | ||
184 | - ], | ||
185 | - "page": "/pages/user/my_service/tment_details?number=" + number, | ||
186 | - "storeId": a.stoid, | ||
187 | - "typeId": "1011", | ||
188 | - "userId": d.user_id | ||
189 | - }; | ||
190 | - var data = JSON.stringify(json); | ||
191 | - //调用发送预约成功模版接口 | ||
192 | - wx.request({ | ||
193 | - url: th.data.inurl + temp_url, | ||
194 | - data: data, | ||
195 | - method: 'post', | ||
196 | - header: { | ||
197 | - 'content-type': 'application/json' | ||
198 | - }, // 设置请求的 header | ||
199 | - success: function(data) {} | ||
200 | - }) | ||
201 | - setTimeout(function() { | ||
202 | - wx.redirectTo({ | ||
203 | - url: "/pages/user/my_service/tment_details?number=" + number | ||
204 | - }); | ||
205 | - }, 1000); | ||
206 | - } else { | ||
207 | - getApp().my_warnning(res.data.msg, 0, th); | ||
208 | - th.setData({ | ||
209 | - is_sub: 0 | ||
210 | - }) | ||
211 | - } | ||
212 | - } | ||
213 | - }) | ||
214 | - } | ||
215 | - } | ||
216 | - }, | ||
217 | - //提交预约 | ||
218 | - sub_success: function(e) { | ||
219 | - var th = this; | ||
220 | - var temp_url = "/api/wx/weappSendlist/page"; | ||
221 | - var template_id = ""; | 223 | + }else{ |
222 | //获取模版id | 224 | //获取模版id |
223 | getApp().request.promiseGet(temp_url, { | 225 | getApp().request.promiseGet(temp_url, { |
224 | data: { | 226 | data: { |
@@ -226,7 +228,7 @@ Page({ | @@ -226,7 +228,7 @@ Page({ | ||
226 | typeid: "1011" | 228 | typeid: "1011" |
227 | } | 229 | } |
228 | }).then(res => { | 230 | }).then(res => { |
229 | - if (res.data.code == 0) { | 231 | + if (res.data.code == 0 && res.data.data.pageData.length > 0) { |
230 | template_id = res.data.data.pageData[0].template_id; | 232 | template_id = res.data.data.pageData[0].template_id; |
231 | // //授权订阅 | 233 | // //授权订阅 |
232 | wx.requestSubscribeMessage({ | 234 | wx.requestSubscribeMessage({ |
@@ -238,11 +240,11 @@ Page({ | @@ -238,11 +240,11 @@ Page({ | ||
238 | th.success(); | 240 | th.success(); |
239 | } | 241 | } |
240 | }) | 242 | }) |
241 | - }else{ | 243 | + } else { |
242 | th.success(); | 244 | th.success(); |
243 | } | 245 | } |
244 | }) | 246 | }) |
245 | - | 247 | + } |
246 | }, | 248 | }, |
247 | goto: function(e) { | 249 | goto: function(e) { |
248 | var th = this; | 250 | var th = this; |
@@ -252,9 +254,14 @@ Page({ | @@ -252,9 +254,14 @@ Page({ | ||
252 | }) | 254 | }) |
253 | if (th.data.store_name == "") { | 255 | if (th.data.store_name == "") { |
254 | getApp().my_warnning("请选择服务门店", 0, th); | 256 | getApp().my_warnning("请选择服务门店", 0, th); |
257 | + th.settime(); | ||
255 | } else if (th.data.beautician_name == "") { | 258 | } else if (th.data.beautician_name == "") { |
256 | getApp().my_warnning("请选择美容师", 0, th); | 259 | getApp().my_warnning("请选择美容师", 0, th); |
260 | + th.settime(); | ||
257 | } else { | 261 | } else { |
262 | + th.setData({ | ||
263 | + is_textea: 1 | ||
264 | + }) | ||
258 | var url = e.currentTarget.dataset.url; | 265 | var url = e.currentTarget.dataset.url; |
259 | getApp().goto(url); | 266 | getApp().goto(url); |
260 | } | 267 | } |
@@ -285,7 +292,8 @@ Page({ | @@ -285,7 +292,8 @@ Page({ | ||
285 | th.setData({ | 292 | th.setData({ |
286 | store: 0, | 293 | store: 0, |
287 | store_name: store_name, | 294 | store_name: store_name, |
288 | - storageId: Id | 295 | + storageId: Id, |
296 | + is_textea: 1 | ||
289 | }) | 297 | }) |
290 | }, | 298 | }, |
291 | onReachBottom: function() { | 299 | onReachBottom: function() { |
@@ -340,6 +348,7 @@ Page({ | @@ -340,6 +348,7 @@ Page({ | ||
340 | } | 348 | } |
341 | } else { | 349 | } else { |
342 | getApp().my_warnning(res.data.msg, 0, th); | 350 | getApp().my_warnning(res.data.msg, 0, th); |
351 | + th.settime(); | ||
343 | } | 352 | } |
344 | }) | 353 | }) |
345 | }, | 354 | }, |
@@ -351,6 +360,7 @@ Page({ | @@ -351,6 +360,7 @@ Page({ | ||
351 | }) | 360 | }) |
352 | if (th.data.store_name == "") { | 361 | if (th.data.store_name == "") { |
353 | getApp().my_warnning("请选择服务门店", 0, th); | 362 | getApp().my_warnning("请选择服务门店", 0, th); |
363 | + th.settime(); | ||
354 | } else { | 364 | } else { |
355 | wx.showLoading({ | 365 | wx.showLoading({ |
356 | title: '加载中', | 366 | title: '加载中', |
@@ -373,6 +383,7 @@ Page({ | @@ -373,6 +383,7 @@ Page({ | ||
373 | }) | 383 | }) |
374 | if (res.data.data.pageData.length < 1) { | 384 | if (res.data.data.pageData.length < 1) { |
375 | getApp().my_warnning("暂无美容师", 0, th); | 385 | getApp().my_warnning("暂无美容师", 0, th); |
386 | + th.settime(); | ||
376 | } else { | 387 | } else { |
377 | if (th.data.beautician == 0) { | 388 | if (th.data.beautician == 0) { |
378 | th.setData({ | 389 | th.setData({ |
@@ -385,7 +396,8 @@ Page({ | @@ -385,7 +396,8 @@ Page({ | ||
385 | } | 396 | } |
386 | } | 397 | } |
387 | } else { | 398 | } else { |
388 | - getApp().my_warnning("暂无美容师", 0, th); | 399 | + getApp().my_warnning(res.data.msg, 0, th); |
400 | + th.settime(); | ||
389 | } | 401 | } |
390 | }) | 402 | }) |
391 | } | 403 | } |
@@ -402,7 +414,7 @@ Page({ | @@ -402,7 +414,7 @@ Page({ | ||
402 | beauticianID: BeauticianID, | 414 | beauticianID: BeauticianID, |
403 | time: "", | 415 | time: "", |
404 | tment_count: "", | 416 | tment_count: "", |
405 | - is_textea: 0 | 417 | + is_textea: 1 |
406 | }) | 418 | }) |
407 | 419 | ||
408 | }, | 420 | }, |
@@ -431,7 +443,6 @@ Page({ | @@ -431,7 +443,6 @@ Page({ | ||
431 | nav_bea: function() { | 443 | nav_bea: function() { |
432 | var th = this; | 444 | var th = this; |
433 | th.setData({ | 445 | th.setData({ |
434 | - is_textea: 0, | ||
435 | beautician: 0 | 446 | beautician: 0 |
436 | }) | 447 | }) |
437 | var storageId = th.data.storageId; //线下门店id | 448 | var storageId = th.data.storageId; //线下门店id |
@@ -439,10 +450,15 @@ Page({ | @@ -439,10 +450,15 @@ Page({ | ||
439 | var project_id = th.data.project_id; | 450 | var project_id = th.data.project_id; |
440 | if (storageId == "") { | 451 | if (storageId == "") { |
441 | getApp().my_warnning("请选择服务门店", 0, th); | 452 | getApp().my_warnning("请选择服务门店", 0, th); |
453 | + th.settime(); | ||
442 | } else { | 454 | } else { |
455 | + th.setData({ | ||
456 | + is_textea: 1 | ||
457 | + }) | ||
443 | wx.navigateTo({ | 458 | wx.navigateTo({ |
444 | url: "/pages/user/my_service/cosmetology_list?" + 'storageId=' + storageId + '&' + 'itemId=' + itemId + '&' + "projectId=" + project_id | 459 | url: "/pages/user/my_service/cosmetology_list?" + 'storageId=' + storageId + '&' + 'itemId=' + itemId + '&' + "projectId=" + project_id |
445 | }); | 460 | }); |
461 | + | ||
446 | } | 462 | } |
447 | }, | 463 | }, |
448 | /** | 464 | /** |
@@ -473,6 +489,7 @@ Page({ | @@ -473,6 +489,7 @@ Page({ | ||
473 | }); | 489 | }); |
474 | if (th.data.is_gps == 0) { | 490 | if (th.data.is_gps == 0) { |
475 | getApp().confirmBox("请开启GPS定位", null, 25000, !1); | 491 | getApp().confirmBox("请开启GPS定位", null, 25000, !1); |
492 | + th.settime(); | ||
476 | } | 493 | } |
477 | } else { | 494 | } else { |
478 | th.setData({ | 495 | th.setData({ |
@@ -509,6 +526,7 @@ Page({ | @@ -509,6 +526,7 @@ Page({ | ||
509 | }) | 526 | }) |
510 | } else { | 527 | } else { |
511 | getApp().my_warnning(res.data.msg, 0, th); | 528 | getApp().my_warnning(res.data.msg, 0, th); |
529 | + th.settime(); | ||
512 | } | 530 | } |
513 | }) | 531 | }) |
514 | 532 | ||
@@ -522,6 +540,10 @@ Page({ | @@ -522,6 +540,10 @@ Page({ | ||
522 | if (seekTime != "") { | 540 | if (seekTime != "") { |
523 | th.query_more(); | 541 | th.query_more(); |
524 | } | 542 | } |
543 | + th.setData({ | ||
544 | + time: th.data.time.substring(0, 16), | ||
545 | + is_textea: 1 | ||
546 | + }) | ||
525 | th.query_project(); | 547 | th.query_project(); |
526 | }, | 548 | }, |
527 | //获取单个服务项目信息 | 549 | //获取单个服务项目信息 |
@@ -542,6 +564,7 @@ Page({ | @@ -542,6 +564,7 @@ Page({ | ||
542 | }) | 564 | }) |
543 | } else { | 565 | } else { |
544 | getApp().my_warnning(res.data.msg, 0, th); | 566 | getApp().my_warnning(res.data.msg, 0, th); |
567 | + th.settime(); | ||
545 | } | 568 | } |
546 | }) | 569 | }) |
547 | }, | 570 | }, |
pages/user/my_service/appment_main.wxml
@@ -69,12 +69,12 @@ | @@ -69,12 +69,12 @@ | ||
69 | <view>注</view> | 69 | <view>注</view> |
70 | </view> | 70 | </view> |
71 | <view class="flex fs26"> | 71 | <view class="flex fs26"> |
72 | - <block wx:if="{{is_textea==1 && store==0}}"> | 72 | + <block wx:if="{{is_textea==1}}"> |
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> |
75 | </block> | 75 | </block> |
76 | <block wx:else> | 76 | <block wx:else> |
77 | - <view class="textarea color" bindtap="check_text">{{remarks==''?'填写备注':remarks}} | 77 | + <view class="textarea {{remarks==''?'color':''}}" bindtap="check_text">{{remarks==''?'填写备注':remarks}} |
78 | </view> | 78 | </view> |
79 | </block> | 79 | </block> |
80 | </view> | 80 | </view> |
pages/user/my_service/hist_service.wxml
@@ -39,6 +39,7 @@ | @@ -39,6 +39,7 @@ | ||
39 | </view> | 39 | </view> |
40 | <!-- right --> | 40 | <!-- right --> |
41 | <view class="serState fs32"> | 41 | <view class="serState fs32"> |
42 | + <view wx:if="{{item.State==0}}">未服务</view> | ||
42 | <view wx:if="{{item.State==1}}">已服务</view> | 43 | <view wx:if="{{item.State==1}}">已服务</view> |
43 | <view wx:if="{{item.State==2}}">已过期</view> | 44 | <view wx:if="{{item.State==2}}">已过期</view> |
44 | <view wx:if="{{item.State==3}}">已取消</view> | 45 | <view wx:if="{{item.State==3}}">已取消</view> |
pages/user/my_service/i_service.js