Commit 3629bfd3292ff5892b3235e58ffe75209e4d3396
1 parent
98267487
小程序预约代码
Showing
5 changed files
with
59 additions
and
31 deletions
pages/user/my_service/appment_main.js
| ... | ... | @@ -368,11 +368,12 @@ Page({ |
| 368 | 368 | is_textea: 0 |
| 369 | 369 | }) |
| 370 | 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 | 372 | var key_word = th.data.key_word; |
| 373 | 373 | key_word = key_word.replace(/\s+/g, ""); |
| 374 | 374 | getApp().request.promiseGet(url, { |
| 375 | 375 | data: { |
| 376 | + userId:getApp().globalData.user_id, | |
| 376 | 377 | storeId: a.stoid, |
| 377 | 378 | serviceId: itemId, |
| 378 | 379 | latitude: th.data.lat, |
| ... | ... | @@ -422,8 +423,9 @@ Page({ |
| 422 | 423 | }) |
| 423 | 424 | var itemid = th.data.itemId; //正式使用的项目id |
| 424 | 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 | 429 | data: { |
| 428 | 430 | storeId: a.stoid, |
| 429 | 431 | userId: d.user_id, |
| ... | ... | @@ -434,9 +436,9 @@ Page({ |
| 434 | 436 | wx.hideLoading(); |
| 435 | 437 | if (res.data.code == 0) { |
| 436 | 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 | 442 | getApp().my_warnning("暂无美容师", 0, th); |
| 441 | 443 | th.settime(); |
| 442 | 444 | } else { |
| ... | ... | @@ -461,7 +463,9 @@ Page({ |
| 461 | 463 | var th = this; |
| 462 | 464 | var bea_index = e.currentTarget.dataset.baaindex; |
| 463 | 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 | 469 | th.setData({ |
| 466 | 470 | beautician_name: bea_name, |
| 467 | 471 | beautician: 0, |
| ... | ... | @@ -469,7 +473,8 @@ Page({ |
| 469 | 473 | beauticianID: BeauticianID, |
| 470 | 474 | time: "", |
| 471 | 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 | 564 | //查询剩下可预约人数 |
| 560 | 565 | query_more: function() { |
| 561 | 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 | 568 | var beauticianID = th.data.beauticianID; //美容师id |
| 564 | 569 | var projectID = th.data.itemId; //服务id |
| 565 | 570 | var seekTime = th.data.time; //预约日期 | ... | ... |
pages/user/my_service/appment_main.wxml
| ... | ... | @@ -55,7 +55,7 @@ |
| 55 | 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 | 59 | <view class="{{time==''?'color':''}}">{{time==""?'选择时间':time}}</view> |
| 60 | 60 | <view class="angle angler">∟</view> |
| 61 | 61 | </view> | ... | ... |
pages/user/my_service/beauty_deta.js
| ... | ... | @@ -19,7 +19,7 @@ Page({ |
| 19 | 19 | comment: "", //美容师评价 |
| 20 | 20 | aweeks: [], //七天的预约时间 |
| 21 | 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 | 23 | weeks: [], //星期几数组 |
| 24 | 24 | time_index: -1, //选择预约时间下标 |
| 25 | 25 | date_id: 0, //选择日期的id |
| ... | ... | @@ -42,12 +42,16 @@ Page({ |
| 42 | 42 | var minutes = myDate.getMinutes(); //获取当前分钟数(0-59) |
| 43 | 43 | var hours = myDate.getHours() + ":" + minutes; //获取当前小时数(0-23) |
| 44 | 44 | var beautician_id = options.BeauticianID; |
| 45 | + var storageId = options.StorageId; | |
| 46 | + | |
| 47 | + | |
| 45 | 48 | th.setData({ |
| 46 | 49 | beautician_id: beautician_id, |
| 47 | 50 | itemId: options.itemId, |
| 48 | 51 | modify: options.modify, |
| 49 | 52 | hours: hours, |
| 50 | - projectId: options.projectId | |
| 53 | + projectId: options.projectId, | |
| 54 | + storageId:storageId | |
| 51 | 55 | }) |
| 52 | 56 | if (options.url != undefined) { |
| 53 | 57 | th.setData({ |
| ... | ... | @@ -226,15 +230,18 @@ Page({ |
| 226 | 230 | query_aweek: function() { |
| 227 | 231 | var th = this; |
| 228 | 232 | var beautician_id = th.data.beautician_id; //美容师id |
| 233 | + var storageId=th.data.storageId; | |
| 234 | + | |
| 229 | 235 | var itemId = th.data.itemId; //服务id |
| 230 | 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 | 238 | getApp().request.promiseGet(url, { |
| 233 | 239 | data: { |
| 234 | 240 | projectId: projectId, |
| 235 | 241 | beauticianId: beautician_id, |
| 236 | 242 | serviceId: itemId, |
| 237 | 243 | storeId: a.stoid, |
| 244 | + storageId:storageId | |
| 238 | 245 | } |
| 239 | 246 | }).then(res => { |
| 240 | 247 | if (res.data.code == 0) { |
| ... | ... | @@ -281,11 +288,12 @@ Page({ |
| 281 | 288 | var SeekTime = th.data.aweeks[date_id].time; |
| 282 | 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 | 292 | getApp().request.promiseGet(url, { |
| 286 | 293 | data: { |
| 287 | 294 | projectId: projectId, |
| 288 | - beauticianId: th.data.beautician_id, | |
| 295 | + staffId: th.data.beautician_id, | |
| 296 | + storageId:th.data.storageId, | |
| 289 | 297 | serviceId: th.data.itemId, |
| 290 | 298 | seekTime: SeekTime, |
| 291 | 299 | storeId: a.stoid, |
| ... | ... | @@ -302,7 +310,7 @@ Page({ |
| 302 | 310 | //不等于空就是有可以预约的时间 |
| 303 | 311 | if (time_list != null) { |
| 304 | 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 | 314 | getApp().my_warnning(res.data.data[0].GroupHour, 0, th); |
| 307 | 315 | } |
| 308 | 316 | } |
| ... | ... | @@ -310,17 +318,15 @@ Page({ |
| 310 | 318 | for (var i = 0; i < time.length; i++) { |
| 311 | 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 | 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 | 324 | new_time[i] = ""; |
| 317 | 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 | 328 | break; |
| 321 | 329 | } |
| 322 | - | |
| 323 | - | |
| 324 | 330 | } else { |
| 325 | 331 | new_time[i] = ""; |
| 326 | 332 | } |
| ... | ... | @@ -393,7 +399,17 @@ Page({ |
| 393 | 399 | return 1; |
| 394 | 400 | } |
| 395 | 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 | 32 | }, |
| 33 | 33 | query_cology: function() { |
| 34 | 34 | var th = this; |
| 35 | - var url = "/api/weshop/marketing/reservation/staff/page"; | |
| 35 | + var url = "/api/weshop/marketing/reservation/staff/pagenew"; | |
| 36 | 36 | var itemId = th.data.itemId; //服务id |
| 37 | 37 | var storageId = th.data.storageId; |
| 38 | 38 | getApp().request.promiseGet(url, { |
| ... | ... | @@ -49,20 +49,20 @@ Page({ |
| 49 | 49 | if (res.data.code == 0) { |
| 50 | 50 | th.data.curpage++; |
| 51 | 51 | var arr1 = th.data.cosmetology_list; |
| 52 | - var arr2 = res.data.data.pageData; | |
| 52 | + var arr2 = res.data.data; | |
| 53 | 53 | var arr3 = [...arr1, ...arr2]; |
| 54 | - var ismore = 0; | |
| 55 | - if (arr3.length == res.data.data.total) ismore = 1 | |
| 54 | + | |
| 55 | + | |
| 56 | 56 | th.setData({ |
| 57 | 57 | cosmetology_list: arr3, |
| 58 | - total: res.data.data.total, | |
| 59 | - ismore: ismore, | |
| 58 | + total: res.data.data.total, | |
| 60 | 59 | is_service_read: 1, |
| 61 | 60 | is_cosmetology_read:1 |
| 62 | 61 | }), wx.stopPullDownRefresh(); //停止下拉刷新 |
| 63 | 62 | } else { |
| 64 | 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 | 95 | */ |
| 96 | 96 | onShow: function() { |
| 97 | 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 | 105 | th.query_cology(); |
| 99 | 106 | }, |
| 100 | 107 | ... | ... |
pages/user/my_service/cosmetology_list.wxml
| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | <!-- 个人属性 --> |
| 9 | 9 | <view class="flex-vertical-between"> |
| 10 | 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 | 12 | <view> |
| 13 | 13 | <!-- 用户名 --> |
| 14 | 14 | <view class="UserName ellipsis-1 fs32">{{item.StaffName}}</view> |
| ... | ... | @@ -27,7 +27,7 @@ |
| 27 | 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 | 31 | <view class="fs24">预约</view> |
| 32 | 32 | </navigator> |
| 33 | 33 | </view> | ... | ... |