Commit 6192417378e0f5a969b1eb7daf838cd8a0cf0996

Authored by 后端研发-倪永富
2 parents 1c08ea95 49e7ddd4

Merge branch 'dev' of http://git.vipzhuang.cn/wxd/MShopWeApp into dev

pages/user/my_service/appment_main.js
... ... @@ -47,23 +47,6 @@ 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   -
67 50 var th = this;
68 51 var is_textea = th.data.is_textea;
69 52 th.setData({
... ... @@ -77,11 +60,13 @@ Page({
77 60 if (store) {
78 61 th.setData({
79 62 store: 0,
  63 + is_textea: 1
80 64 })
81 65 } else {
82 66 th.setData({
83 67 beautician: 0,
84 68 store: 1,
  69 + is_textea: 0
85 70 })
86 71 if (th.data.store_list.length < 1) {
87 72 wx.showLoading({
... ... @@ -101,124 +86,141 @@ Page({
101 86 //提交成功及发送模版代码
102 87 success: function() {
103 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 202 var store = th.data.store_name; //门店名称
108 203 var bea_name = th.data.beautician_name; //美容师名称
109 204 var time = th.data.time; //预约时间
110 205 var is_sub = th.data.is_sub; //是否重复提交
  206 + th.setData({
  207 + is_textea: 0,
  208 + is_sub: 1
  209 + })
111 210 //提交预约前的判断
112 211 if (store == "") {
113 212 getApp().my_warnning("请选择服务门店", 0, th);
  213 + th.settime();
114 214 return false;
115 215 } else if (bea_name == "") {
116 216 getApp().my_warnning("请选择美容师", 0, th);
  217 + th.settime();
117 218 return false;
118 219 } else if (time == "") {
119 220 getApp().my_warnning("请选择预约时间", 0, th);
  221 + th.settime();
120 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 224 //获取模版id
223 225 getApp().request.promiseGet(temp_url, {
224 226 data: {
... ... @@ -226,7 +228,7 @@ Page({
226 228 typeid: "1011"
227 229 }
228 230 }).then(res => {
229   - if (res.data.code == 0) {
  231 + if (res.data.code == 0 && res.data.data.pageData.length > 0) {
230 232 template_id = res.data.data.pageData[0].template_id;
231 233 // //授权订阅
232 234 wx.requestSubscribeMessage({
... ... @@ -238,11 +240,11 @@ Page({
238 240 th.success();
239 241 }
240 242 })
241   - }else{
  243 + } else {
242 244 th.success();
243 245 }
244 246 })
245   -
  247 + }
246 248 },
247 249 goto: function(e) {
248 250 var th = this;
... ... @@ -252,9 +254,14 @@ Page({
252 254 })
253 255 if (th.data.store_name == "") {
254 256 getApp().my_warnning("请选择服务门店", 0, th);
  257 + th.settime();
255 258 } else if (th.data.beautician_name == "") {
256 259 getApp().my_warnning("请选择美容师", 0, th);
  260 + th.settime();
257 261 } else {
  262 + th.setData({
  263 + is_textea: 1
  264 + })
258 265 var url = e.currentTarget.dataset.url;
259 266 getApp().goto(url);
260 267 }
... ... @@ -285,7 +292,8 @@ Page({
285 292 th.setData({
286 293 store: 0,
287 294 store_name: store_name,
288   - storageId: Id
  295 + storageId: Id,
  296 + is_textea: 1
289 297 })
290 298 },
291 299 onReachBottom: function() {
... ... @@ -340,6 +348,7 @@ Page({
340 348 }
341 349 } else {
342 350 getApp().my_warnning(res.data.msg, 0, th);
  351 + th.settime();
343 352 }
344 353 })
345 354 },
... ... @@ -351,6 +360,7 @@ Page({
351 360 })
352 361 if (th.data.store_name == "") {
353 362 getApp().my_warnning("请选择服务门店", 0, th);
  363 + th.settime();
354 364 } else {
355 365 wx.showLoading({
356 366 title: '加载中',
... ... @@ -373,6 +383,7 @@ Page({
373 383 })
374 384 if (res.data.data.pageData.length < 1) {
375 385 getApp().my_warnning("暂无美容师", 0, th);
  386 + th.settime();
376 387 } else {
377 388 if (th.data.beautician == 0) {
378 389 th.setData({
... ... @@ -385,7 +396,8 @@ Page({
385 396 }
386 397 }
387 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 414 beauticianID: BeauticianID,
403 415 time: "",
404 416 tment_count: "",
405   - is_textea: 0
  417 + is_textea: 1
406 418 })
407 419  
408 420 },
... ... @@ -431,7 +443,6 @@ Page({
431 443 nav_bea: function() {
432 444 var th = this;
433 445 th.setData({
434   - is_textea: 0,
435 446 beautician: 0
436 447 })
437 448 var storageId = th.data.storageId; //线下门店id
... ... @@ -439,10 +450,15 @@ Page({
439 450 var project_id = th.data.project_id;
440 451 if (storageId == "") {
441 452 getApp().my_warnning("请选择服务门店", 0, th);
  453 + th.settime();
442 454 } else {
  455 + th.setData({
  456 + is_textea: 1
  457 + })
443 458 wx.navigateTo({
444 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 489 });
474 490 if (th.data.is_gps == 0) {
475 491 getApp().confirmBox("请开启GPS定位", null, 25000, !1);
  492 + th.settime();
476 493 }
477 494 } else {
478 495 th.setData({
... ... @@ -509,6 +526,7 @@ Page({
509 526 })
510 527 } else {
511 528 getApp().my_warnning(res.data.msg, 0, th);
  529 + th.settime();
512 530 }
513 531 })
514 532  
... ... @@ -522,6 +540,10 @@ Page({
522 540 if (seekTime != "") {
523 541 th.query_more();
524 542 }
  543 + th.setData({
  544 + time: th.data.time.substring(0, 16),
  545 + is_textea: 1
  546 + })
525 547 th.query_project();
526 548 },
527 549 //获取单个服务项目信息
... ... @@ -542,6 +564,7 @@ Page({
542 564 })
543 565 } else {
544 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 69 <view>注</view>
70 70 </view>
71 71 <view class="flex fs26">
72   - <block wx:if="{{is_textea==1 && store==0}}">
  72 + <block wx:if="{{is_textea==1}}">
73 73 <textarea class="textarea" placeholder="{{remarks==''?'填写备注':remarks}}" placeholder-class="fs26 color" value="{{remarks}}" bindinput="input_remarks" maxlength="100">
74 74 </textarea>
75 75 </block>
76 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 78 </view>
79 79 </block>
80 80 </view>
... ...
pages/user/my_service/hist_service.wxml
... ... @@ -39,6 +39,7 @@
39 39 </view>
40 40 <!-- right -->
41 41 <view class="serState fs32">
  42 + <view wx:if="{{item.State==0}}">未服务</view>
42 43 <view wx:if="{{item.State==1}}">已服务</view>
43 44 <view wx:if="{{item.State==2}}">已过期</view>
44 45 <view wx:if="{{item.State==3}}">已取消</view>
... ...
pages/user/my_service/i_service.js
... ... @@ -86,7 +86,9 @@ Page({
86 86 }),
87 87 wx.stopPullDownRefresh(); //停止下拉刷新
88 88 } else {
89   - getApp().my_warnning(res.data.msg, 0, th);
  89 + th.setData({
  90 + is_service_read: 1
  91 + })
90 92 }
91 93 })
92 94 },
... ...