beauty_deta.js
3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
var e = getApp(),
a = e.globalData.setting,
os = a,
t = e.request,
d = e.globalData;
Page({
/**
* 页面的初始数据
*/
data: {
iurl: a.imghost,
seekTime: "2019-11-18", //当前服务预约选择的时间
time_list: [], //可预约时间
name: "", //美容师姓名
comment: "", //美容师评价
head_img: "", //美容师头像
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"],
time_index: 0, //选择预约时间下标
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
var th = this;
th.query_beatea();
th.query_date();
},
//图片失败,默认图片
bind_bnerr1: function(e) {
var _errImg = e.target.dataset.errorimg;
var _Img = e.target.dataset.img;
if (_Img != undefined) {
var _errObj = {};
_errObj[_errImg] = "/miniapp/images/no_cate_def.png";
this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
}
},
//获取美容师信息
query_beatea: function() {
var th = this;
var url = "/api/weshop/marketing/reservation/staff/page"; //接口路径
var itemId = "08AD49D5-BAFD-4B5E-ABBA-B180EB64EED6",
storageId = "FD8EC44A-6474-4BA1-A17C-A87306690E59";
getApp().request.promiseGet(url, {
data: {
itemId: itemId,
storageId: storageId,
storeId: 1,
userId: 5682130
}
}).then(res => {
if (res.data.code == 0) {
var data = res.data.data.pageData;
th.setData({
name: data[0].StaffName,
comment: data[0].Remark1,
head_img: data[0].PhotoUrl
})
} else {
getApp().my_warnning(res.data.msg, 0, th);
}
})
},
//返回上个页面
navigateBack:function(){
wx.navigateBack({ changed: true });//返回上一页
},
//选择时间
Selection_time: function(e) {
var th = this;
var index = e.currentTarget.dataset.index;
var time_index = th.data.time_index;
if (index == time_index) {
return;
} else {
th.setData({
time_index: time_index
})
}
},
query_date: function() {
var th = this;
var url = "/api/weshop/marketing/reservation/staff/time/list";
var SeekTime = th.data.seekTime;
getApp().request.promiseGet(url, {
data: {
BeauticianID: "337C11B8-034B-495D-B360-FC2F6CB29394",
ProjectID: "08AD49D5-BAFD-4B5E-ABBA-B180EB64EED6",
SeekTime: SeekTime,
storeId: a.stoid,
}
}).then(res => {
if (res.data.code == 0) {
var data = res.data.data;
var time = th.data.time; //固定时间
var time_list = [];
for (var i = 0; i < time.length; i++) {
for (var ii = ii; ii < data.length; ii++) {
if (time[i] == data[ii]) {
time_list[i] = data[ii];
break;
} else {
time_list[i] = "";
}
}
}
th.setData({
time_list: time_list
})
} else {
getApp().my_warnning(res.data.msg, 0, th);
}
})
},
})