appment_main.js
2.9 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
var e = getApp(),
a = e.globalData.setting,
os = a,
t = e.request;
Page({
/**
* 页面的初始数据
*/
data: {
iurl: a.imghost, //服务器网址
store: 0, //是否显示服务门店列表
beautician: 0, //是否显示美容师列表
beautician_name: null, //选中的美容师名称
placeholder: "填写备注", //备注为空的placeholder
store_list: null, //门店列表
store_name: null, //选择的服务门店
fir_pick_index: 0, //选择的门店下标
},
onclickstore: function() {
var th = this;
var store = th.data.store;
if (store) {
th.setData({
store: 0,
placeholder: "填写备注"
})
} else {
th.setData({
store: 1,
placeholder: ""
})
}
},
query_bea: function(e) {
var th = this;
//获取选择美容师字段是不是为null,是的话就提示用户先选择门店
if (true) {
var beautician = th.data.beautician;
var beaname = e.currentTarget.dataset.beaname;
if (beautician) {
// 判断是否选择美容师没有的话就把美容师列表收起来
if (beaname != undefined) {
th.setData({
beautician: 0,
beautician_name: beaname,
placeholder: "填写备注"
})
} else {
th.setData({
beautician: 0,
placeholder: "填写备注"
})
}
} else {
th.setData({
beautician: 1,
placeholder: ""
})
}
} else {
getApp().my_warnning("请先选择服务门店", 0, th);
}
},
goto: function(e) {
var th = this;
if (th.data.beautician_name != null) {
var url = e.currentTarget.dataset.url;
getApp().goto(url);
} else {
getApp().my_warnning("请先选择美容师", 0, th);
}
},
//点击选择门店
choose_for_store: function(e) {
var th = this;
var index_c = e.currentTarget.dataset.ind;
var fir_pick_index = th.data.fir_pick_index;
//判断是否点击选中的门店,防止重复点击重复设置选中下标
if (index_c == fir_pick_index) {
return false;
} else {
th.setData({
fir_pick_index: index_c
})
}
},
//确认选择门店
choice_store: function() {
var th = this;
var index = th.data.fir_pick_index;
var pickup_name = th.data.store_list[index].pickup_name;
th.setData({
store: 0,
store_name: pickup_name
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
var th = this;
wx.request({
url: 'http://localhost:8022/api/weshop/yy_fuwu_sto',
success: function(e) {
if (e.data.code == 0) {
th.setData({
store_list: e.data.data.pageData
})
}
}
})
}
})