Commit 3629bfd3292ff5892b3235e58ffe75209e4d3396

Authored by yvan.ni
1 parent 98267487

小程序预约代码

pages/user/my_service/appment_main.js
@@ -368,11 +368,12 @@ Page({ @@ -368,11 +368,12 @@ Page({
368 is_textea: 0 368 is_textea: 0
369 }) 369 })
370 var itemId = th.data.itemId; //服务id 370 var itemId = th.data.itemId; //服务id
371 - var url = "/api/weshop/marketing/reservation/storage/page"; 371 + var url = "/api/weshop/marketing/reservation/storage/pagenew";
372 var key_word = th.data.key_word; 372 var key_word = th.data.key_word;
373 key_word = key_word.replace(/\s+/g, ""); 373 key_word = key_word.replace(/\s+/g, "");
374 getApp().request.promiseGet(url, { 374 getApp().request.promiseGet(url, {
375 data: { 375 data: {
  376 + userId:getApp().globalData.user_id,
376 storeId: a.stoid, 377 storeId: a.stoid,
377 serviceId: itemId, 378 serviceId: itemId,
378 latitude: th.data.lat, 379 latitude: th.data.lat,
@@ -422,8 +423,9 @@ Page({ @@ -422,8 +423,9 @@ Page({
422 }) 423 })
423 var itemid = th.data.itemId; //正式使用的项目id 424 var itemid = th.data.itemId; //正式使用的项目id
424 var storageId = th.data.storageId; //正式使用的线下门店id 425 var storageId = th.data.storageId; //正式使用的线下门店id
425 - var url = "/api/weshop/marketing/reservation/staff/page"; //接口地址  
426 - getApp().request.promiseGet(url, { 426 + var url = "/api/weshop/marketing/reservation/staff/pagenew"; //接口地址
  427 +
  428 + getApp().request.promiseGet(url, {
427 data: { 429 data: {
428 storeId: a.stoid, 430 storeId: a.stoid,
429 userId: d.user_id, 431 userId: d.user_id,
@@ -434,9 +436,9 @@ Page({ @@ -434,9 +436,9 @@ Page({
434 wx.hideLoading(); 436 wx.hideLoading();
435 if (res.data.code == 0) { 437 if (res.data.code == 0) {
436 th.setData({ 438 th.setData({
437 - beautician_list: res.data.data.pageData 439 + beautician_list: res.data.data
438 }) 440 })
439 - if (res.data.data.pageData.length < 1) { 441 + if (res.data.data.length < 1) {
440 getApp().my_warnning("暂无美容师", 0, th); 442 getApp().my_warnning("暂无美容师", 0, th);
441 th.settime(); 443 th.settime();
442 } else { 444 } else {
@@ -461,7 +463,9 @@ Page({ @@ -461,7 +463,9 @@ Page({
461 var th = this; 463 var th = this;
462 var bea_index = e.currentTarget.dataset.baaindex; 464 var bea_index = e.currentTarget.dataset.baaindex;
463 var bea_name = th.data.beautician_list[bea_index].StaffName; 465 var bea_name = th.data.beautician_list[bea_index].StaffName;
464 - var BeauticianID = th.data.beautician_list[bea_index].Id; 466 + var BeauticianID = th.data.beautician_list[bea_index].staffid;
  467 + var StorageId=th.data.beautician_list[bea_index].StorageId
  468 +
465 th.setData({ 469 th.setData({
466 beautician_name: bea_name, 470 beautician_name: bea_name,
467 beautician: 0, 471 beautician: 0,
@@ -469,7 +473,8 @@ Page({ @@ -469,7 +473,8 @@ Page({
469 beauticianID: BeauticianID, 473 beauticianID: BeauticianID,
470 time: "", 474 time: "",
471 tment_count: "", 475 tment_count: "",
472 - is_textea: 1 476 + is_textea: 1,
  477 + StorageId:StorageId
473 }) 478 })
474 479
475 }, 480 },
@@ -559,7 +564,7 @@ Page({ @@ -559,7 +564,7 @@ Page({
559 //查询剩下可预约人数 564 //查询剩下可预约人数
560 query_more: function() { 565 query_more: function() {
561 var th = this; 566 var th = this;
562 - var url = "/api/weshop/marketing/reservation/can/reservation/count"; 567 + var url = "/api/weshop/marketing/reservation/can/reservation/countnew";
563 var beauticianID = th.data.beauticianID; //美容师id 568 var beauticianID = th.data.beauticianID; //美容师id
564 var projectID = th.data.itemId; //服务id 569 var projectID = th.data.itemId; //服务id
565 var seekTime = th.data.time; //预约日期 570 var seekTime = th.data.time; //预约日期
pages/user/my_service/appment_main.wxml
@@ -55,7 +55,7 @@ @@ -55,7 +55,7 @@
55 </view> 55 </view>
56 56
57 <!-- 选择时间 --> 57 <!-- 选择时间 -->
58 - <view class="flex-vertical-between fs26 select" data-url="/pages/user/my_service/beauty_deta?url+{{url}}&BeauticianID={{beauticianID}}&itemId={{itemId}}&modify=0&projectId={{project_id}}" bindtap="goto"> 58 + <view class="flex-vertical-between fs26 select" data-url="/pages/user/my_service/beauty_deta?url={{url}}&StorageId={{StorageId}}&BeauticianID={{beauticianID}}&itemId={{itemId}}&modify=0&projectId={{project_id}}" bindtap="goto">
59 <view class="{{time==''?'color':''}}">{{time==""?'选择时间':time}}</view> 59 <view class="{{time==''?'color':''}}">{{time==""?'选择时间':time}}</view>
60 <view class="angle angler">∟</view> 60 <view class="angle angler">∟</view>
61 </view> 61 </view>
pages/user/my_service/beauty_deta.js
@@ -19,7 +19,7 @@ Page({ @@ -19,7 +19,7 @@ Page({
19 comment: "", //美容师评价 19 comment: "", //美容师评价
20 aweeks: [], //七天的预约时间 20 aweeks: [], //七天的预约时间
21 head_img: "", //美容师头像 21 head_img: "", //美容师头像
22 - time: ["08:00", "09:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00"], 22 + time:['08:00','08:30', '09:00', '09:30', '10:00', '10:30', '11:00', '11:30', '12:00', '12:30', '13:00', '13:30', '14:00','14:30', '15:00', '15:30', '16:00', '16:30', '17:00','17:30', '18:00','18:30', '19:00', '19:30', '20:00', '20:30', '21:00', '21:30', '22:00','22:30'],
23 weeks: [], //星期几数组 23 weeks: [], //星期几数组
24 time_index: -1, //选择预约时间下标 24 time_index: -1, //选择预约时间下标
25 date_id: 0, //选择日期的id 25 date_id: 0, //选择日期的id
@@ -42,12 +42,16 @@ Page({ @@ -42,12 +42,16 @@ Page({
42 var minutes = myDate.getMinutes(); //获取当前分钟数(0-59) 42 var minutes = myDate.getMinutes(); //获取当前分钟数(0-59)
43 var hours = myDate.getHours() + ":" + minutes; //获取当前小时数(0-23) 43 var hours = myDate.getHours() + ":" + minutes; //获取当前小时数(0-23)
44 var beautician_id = options.BeauticianID; 44 var beautician_id = options.BeauticianID;
  45 + var storageId = options.StorageId;
  46 +
  47 +
45 th.setData({ 48 th.setData({
46 beautician_id: beautician_id, 49 beautician_id: beautician_id,
47 itemId: options.itemId, 50 itemId: options.itemId,
48 modify: options.modify, 51 modify: options.modify,
49 hours: hours, 52 hours: hours,
50 - projectId: options.projectId 53 + projectId: options.projectId,
  54 + storageId:storageId
51 }) 55 })
52 if (options.url != undefined) { 56 if (options.url != undefined) {
53 th.setData({ 57 th.setData({
@@ -226,15 +230,18 @@ Page({ @@ -226,15 +230,18 @@ Page({
226 query_aweek: function() { 230 query_aweek: function() {
227 var th = this; 231 var th = this;
228 var beautician_id = th.data.beautician_id; //美容师id 232 var beautician_id = th.data.beautician_id; //美容师id
  233 + var storageId=th.data.storageId;
  234 +
229 var itemId = th.data.itemId; //服务id 235 var itemId = th.data.itemId; //服务id
230 var projectId = th.data.projectId; //项目id 236 var projectId = th.data.projectId; //项目id
231 - var url = "/api/weshop/marketing/reservation/staff/seven/time/list"; //接口地址 237 + var url = "/api/weshop/marketing/reservation/staff/seven/time/listnew"; //接口地址
232 getApp().request.promiseGet(url, { 238 getApp().request.promiseGet(url, {
233 data: { 239 data: {
234 projectId: projectId, 240 projectId: projectId,
235 beauticianId: beautician_id, 241 beauticianId: beautician_id,
236 serviceId: itemId, 242 serviceId: itemId,
237 storeId: a.stoid, 243 storeId: a.stoid,
  244 + storageId:storageId
238 } 245 }
239 }).then(res => { 246 }).then(res => {
240 if (res.data.code == 0) { 247 if (res.data.code == 0) {
@@ -281,11 +288,12 @@ Page({ @@ -281,11 +288,12 @@ Page({
281 var SeekTime = th.data.aweeks[date_id].time; 288 var SeekTime = th.data.aweeks[date_id].time;
282 var val = th.data.aweeks[date_id].val; 289 var val = th.data.aweeks[date_id].val;
283 290
284 - var url = "/api/weshop/marketing/reservation/staff/time/list"; 291 + var url = "/api/weshop/marketing/reservation/staff/time/listnew";
285 getApp().request.promiseGet(url, { 292 getApp().request.promiseGet(url, {
286 data: { 293 data: {
287 projectId: projectId, 294 projectId: projectId,
288 - beauticianId: th.data.beautician_id, 295 + staffId: th.data.beautician_id,
  296 + storageId:th.data.storageId,
289 serviceId: th.data.itemId, 297 serviceId: th.data.itemId,
290 seekTime: SeekTime, 298 seekTime: SeekTime,
291 storeId: a.stoid, 299 storeId: a.stoid,
@@ -302,7 +310,7 @@ Page({ @@ -302,7 +310,7 @@ Page({
302 //不等于空就是有可以预约的时间 310 //不等于空就是有可以预约的时间
303 if (time_list != null) { 311 if (time_list != null) {
304 if (res.data.data[0].GroupHour != undefined) { 312 if (res.data.data[0].GroupHour != undefined) {
305 - if (res.data.data[0].GroupHour.length > 11) { 313 + if (res.data.data[0].GroupHour && res.data.data[0].GroupHour.length > 11) {
306 getApp().my_warnning(res.data.data[0].GroupHour, 0, th); 314 getApp().my_warnning(res.data.data[0].GroupHour, 0, th);
307 } 315 }
308 } 316 }
@@ -310,17 +318,15 @@ Page({ @@ -310,17 +318,15 @@ Page({
310 for (var i = 0; i < time.length; i++) { 318 for (var i = 0; i < time.length; i++) {
311 for (var ii = 0; ii < time_list.length; ii++) { 319 for (var ii = 0; ii < time_list.length; ii++) {
312 //判断固定的时间和可以预约的时间 320 //判断固定的时间和可以预约的时间
313 - if (time[i] == time_list[ii].GroupHour.substring(0, 5)) { 321 + if (time[i] == time_list[ii].begintime.substring(0, 5)) {
314 var date_id = th.data.date_id; 322 var date_id = th.data.date_id;
315 - if (date > time_list[ii].GroupHour.substring(0, 2) && date_id == 0) { 323 + if (date > time_list[ii].begintime.substring(0, 2) && date_id == 0) {
316 new_time[i] = ""; 324 new_time[i] = "";
317 break; 325 break;
318 - } else {  
319 - new_time[i] = time_list[ii].GroupHour.substring(0, 5); 326 + }else{
  327 + new_time[i] = time_list[ii].begintime.substring(0, 5);
320 break; 328 break;
321 } 329 }
322 -  
323 -  
324 } else { 330 } else {
325 new_time[i] = ""; 331 new_time[i] = "";
326 } 332 }
@@ -393,7 +399,17 @@ Page({ @@ -393,7 +399,17 @@ Page({
393 return 1; 399 return 1;
394 } 400 }
395 return 0; 401 return 0;
396 - } 402 + },
  403 +
  404 + check_is_in_arr:function(val,pdata) {
  405 + if(!val || !pdata) return false;
  406 + for(var i in pdata){
  407 + if(pdata[i].begintime.indexOf(val)!=-1){
  408 + return true;
  409 + }
  410 + }
  411 + return false;
  412 + }
397 413
398 414
399 415
pages/user/my_service/cosmetology_list.js
@@ -32,7 +32,7 @@ Page({ @@ -32,7 +32,7 @@ Page({
32 }, 32 },
33 query_cology: function() { 33 query_cology: function() {
34 var th = this; 34 var th = this;
35 - var url = "/api/weshop/marketing/reservation/staff/page"; 35 + var url = "/api/weshop/marketing/reservation/staff/pagenew";
36 var itemId = th.data.itemId; //服务id 36 var itemId = th.data.itemId; //服务id
37 var storageId = th.data.storageId; 37 var storageId = th.data.storageId;
38 getApp().request.promiseGet(url, { 38 getApp().request.promiseGet(url, {
@@ -49,20 +49,20 @@ Page({ @@ -49,20 +49,20 @@ Page({
49 if (res.data.code == 0) { 49 if (res.data.code == 0) {
50 th.data.curpage++; 50 th.data.curpage++;
51 var arr1 = th.data.cosmetology_list; 51 var arr1 = th.data.cosmetology_list;
52 - var arr2 = res.data.data.pageData; 52 + var arr2 = res.data.data;
53 var arr3 = [...arr1, ...arr2]; 53 var arr3 = [...arr1, ...arr2];
54 - var ismore = 0;  
55 - if (arr3.length == res.data.data.total) ismore = 1 54 +
  55 +
56 th.setData({ 56 th.setData({
57 cosmetology_list: arr3, 57 cosmetology_list: arr3,
58 - total: res.data.data.total,  
59 - ismore: ismore, 58 + total: res.data.data.total,
60 is_service_read: 1, 59 is_service_read: 1,
61 is_cosmetology_read:1 60 is_cosmetology_read:1
62 }), wx.stopPullDownRefresh(); //停止下拉刷新 61 }), wx.stopPullDownRefresh(); //停止下拉刷新
63 } else { 62 } else {
64 th.setData({ 63 th.setData({
65 - is_cosmetology_read:1 64 + is_cosmetology_read:1,
  65 + ismore:1
66 }) 66 })
67 } 67 }
68 }) 68 })
@@ -95,6 +95,13 @@ Page({ @@ -95,6 +95,13 @@ Page({
95 */ 95 */
96 onShow: function() { 96 onShow: function() {
97 var th = this; 97 var th = this;
  98 + th.data.curpage++;
  99 + th.setData({
  100 + cosmetology_list: [],
  101 + total: 0,
  102 + is_service_read: 0,
  103 + is_cosmetology_read:0
  104 + })
98 th.query_cology(); 105 th.query_cology();
99 }, 106 },
100 107
pages/user/my_service/cosmetology_list.wxml
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 <!-- 个人属性 --> 8 <!-- 个人属性 -->
9 <view class="flex-vertical-between"> 9 <view class="flex-vertical-between">
10 <view class="flex-vertical"> 10 <view class="flex-vertical">
11 - <image class="portrait" src="{{item.PhotoUrl==''?iurl+defimgurl:item.PhotoUrl}}" lazy-load="true" data-errorimg="cosmetology_list[{{index}}].PhotoUrl" binderror="bind_bnerr1" data-img="cosmetology_list[{{index}}].PhotoUrl"></image> 11 + <image class="portrait" src="{{(!item.PhotoUrl || item.PhotoUrl=='')?iurl+defimgurl:item.PhotoUrl}}" lazy-load="true" data-errorimg="cosmetology_list[{{index}}].PhotoUrl" binderror="bind_bnerr1" data-img="cosmetology_list[{{index}}].PhotoUrl"></image>
12 <view> 12 <view>
13 <!-- 用户名 --> 13 <!-- 用户名 -->
14 <view class="UserName ellipsis-1 fs32">{{item.StaffName}}</view> 14 <view class="UserName ellipsis-1 fs32">{{item.StaffName}}</view>
@@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
27 </view> 27 </view>
28 28
29 <!-- 预约状态 --> 29 <!-- 预约状态 -->
30 - <navigator class="flex-center gofu go" url="/pages/user/my_service/beauty_deta?BeauticianID={{item.Id}}&itemId={{itemId}}&iscos=1&modify=0&projectId={{projectId}}&StaffName={{item.StaffName}}"> 30 + <navigator class="flex-center gofu go" url="/pages/user/my_service/beauty_deta?StorageId={{item.StorageId}}&BeauticianID={{item.staffid}}&itemId={{itemId}}&iscos=1&modify=0&projectId={{projectId}}&StaffName={{item.StaffName}}">
31 <view class="fs24">预约</view> 31 <view class="fs24">预约</view>
32 </navigator> 32 </navigator>
33 </view> 33 </view>