Commit af4f3123c49112523be8ec1b2b4a83e5f62f0e3c
1 parent
90d18c60
js还原
Showing
1 changed file
with
123 additions
and
41 deletions
packageG/pages/user/my_service/tment_details.js
1 | -// packageG/pages/user/my_service/tment_details.js | 1 | +var e = getApp(), |
2 | + a = e.globalData.setting, | ||
3 | + os = a, | ||
4 | + t = e.request, | ||
5 | + d = e.globalData; | ||
2 | Page({ | 6 | Page({ |
3 | 7 | ||
4 | /** | 8 | /** |
5 | * 页面的初始数据 | 9 | * 页面的初始数据 |
6 | */ | 10 | */ |
7 | data: { | 11 | data: { |
12 | + url: a.url, | ||
13 | + iurl: a.imghost, | ||
14 | + tment_details: [], //预约详情 | ||
15 | + number: "", //订单号 | ||
16 | + arrangeTime: "", //预约年月日 | ||
17 | + day: "", //判断是上午还是下午 | ||
18 | + states: 3, //3为取消预约 | ||
19 | + }, | ||
20 | + //取消预约 | ||
21 | + cancel_tment: function(e) { | ||
22 | + var th = this; | ||
23 | + var my_confirm = th.selectComponent("#my_confirm"); //组件的id | ||
24 | + my_confirm.open( | ||
25 | + "确定取消?", | ||
26 | + "取消", | ||
27 | + "确定", | ||
28 | + function() { | ||
29 | + my_confirm.open_cancel(0); | ||
30 | + }, | ||
31 | + function() { | ||
32 | + var index = e.currentTarget.dataset.index; | ||
33 | + var states = th.data.states; | ||
34 | + var tment_details = th.data.tment_details; | ||
35 | + var number = th.data.number; | ||
36 | + var json = { | ||
37 | + "number": number, | ||
38 | + "storeId": a.stoid, | ||
39 | + "states": states | ||
40 | + }; | ||
41 | + var data = JSON.stringify(json); | ||
42 | + var url = th.data.url + "/api/weshop/marketing/reservation/reservation/update"; //预约接口地址 | ||
43 | + wx.request({ | ||
44 | + url: url, | ||
45 | + data: data, | ||
46 | + method: 'put', | ||
47 | + header: { | ||
48 | + 'content-type': 'application/json' | ||
49 | + }, // 设置请求的 header | ||
50 | + success: function(res) { | ||
51 | + my_confirm.open_cancel(0); | ||
52 | + if (res.data.code == 0) { | ||
53 | + getApp().my_warnning("取消成功", 1, th); | ||
54 | + var start = 'tment_details[' + 0 + '].State'; | ||
55 | + th.setData({ | ||
56 | + [start]: 3 | ||
57 | + }) | ||
58 | + } else { | ||
59 | + getApp().my_warnning(res.data.msg, 0, th); | ||
60 | + } | ||
61 | + } | ||
62 | + }) | ||
63 | + } | ||
64 | + ); | ||
8 | 65 | ||
9 | }, | 66 | }, |
10 | 67 | ||
11 | /** | 68 | /** |
12 | * 生命周期函数--监听页面加载 | 69 | * 生命周期函数--监听页面加载 |
13 | */ | 70 | */ |
14 | - onLoad(options) { | 71 | + onLoad: function(options) { |
72 | + var th = this; | ||
73 | + th.setData({ | ||
74 | + number: options.number | ||
75 | + }) | ||
15 | 76 | ||
16 | - }, | ||
17 | - | ||
18 | - /** | ||
19 | - * 生命周期函数--监听页面初次渲染完成 | ||
20 | - */ | ||
21 | - onReady() { | 77 | + var user=getApp().globalData.userInfo; |
78 | + if(!user){ | ||
79 | + getApp().goto("/packageE/pages/togoin/togoin"); | ||
80 | + } | ||
22 | 81 | ||
23 | }, | 82 | }, |
24 | - | ||
25 | - /** | ||
26 | - * 生命周期函数--监听页面显示 | ||
27 | - */ | ||
28 | - onShow() { | ||
29 | - | 83 | + //查询美容师详情 |
84 | + query_bea: function() { | ||
85 | + var th = this; | ||
86 | + var number = th.data.number; | ||
87 | + var url = "/api/weshop/marketing/reservation/reservation/page"; | ||
88 | + getApp().request.promiseGet(url, { | ||
89 | + data: { | ||
90 | + storeId: a.stoid, | ||
91 | + userId: d.user_id, | ||
92 | + number: number | ||
93 | + } | ||
94 | + }).then(res => { | ||
95 | + wx.hideLoading(); | ||
96 | + if (res.data.code == 0) { | ||
97 | + var data = res.data.data.pageData; | ||
98 | + var arrangeTime = data[0].ArrangeTime.substring(0, 11); | ||
99 | + var day = data[0].ArrangeTime.substring(11, 16); | ||
100 | + th.setData({ | ||
101 | + tment_details: data, | ||
102 | + arrangeTime: arrangeTime, | ||
103 | + day: day | ||
104 | + }) | ||
105 | + | ||
106 | + } else { | ||
107 | + getApp().my_warnning(res.data.msg, 0, th); | ||
108 | + } | ||
109 | + }) | ||
30 | }, | 110 | }, |
31 | - | ||
32 | - /** | ||
33 | - * 生命周期函数--监听页面隐藏 | ||
34 | - */ | ||
35 | - onHide() { | ||
36 | - | 111 | + //显示核销码 |
112 | + code_show: function(e) { | ||
113 | + var th = this; | ||
114 | + //--获取成功的时候-- | ||
115 | + var no = e.currentTarget.dataset.order_sn; | ||
116 | + var qc_com = th.selectComponent("#qc_com"); //组件的id | ||
117 | + var obj = { | ||
118 | + val: no, | ||
119 | + content: "请将二维码展示给核销员,使用更快捷" | ||
120 | + }; | ||
121 | + qc_com.open(obj) | ||
37 | }, | 122 | }, |
38 | - | ||
39 | - /** | ||
40 | - * 生命周期函数--监听页面卸载 | ||
41 | - */ | ||
42 | - onUnload() { | ||
43 | - | 123 | + //跳到首页 |
124 | + goto: function(e) { | ||
125 | + var th = this; | ||
126 | + wx.navigateTo({ | ||
127 | + url: '/pages/index/index/index', | ||
128 | + }) | ||
44 | }, | 129 | }, |
45 | - | ||
46 | /** | 130 | /** |
47 | - * 页面相关事件处理函数--监听用户下拉动作 | 131 | + * 生命周期函数--监听页面显示 |
48 | */ | 132 | */ |
49 | - onPullDownRefresh() { | ||
50 | - | ||
51 | - }, | 133 | + onShow: function() { |
52 | 134 | ||
53 | - /** | ||
54 | - * 页面上拉触底事件的处理函数 | ||
55 | - */ | ||
56 | - onReachBottom() { | 135 | + var user=getApp().globalData.userInfo; |
136 | + if(user){ | ||
137 | + var th = this; | ||
138 | + th.query_bea(); | ||
139 | + } | ||
57 | 140 | ||
58 | }, | 141 | }, |
59 | - | ||
60 | - /** | ||
61 | - * 用户点击右上角分享 | ||
62 | - */ | ||
63 | - onShareAppMessage() { | ||
64 | - | 142 | + //关闭导航 |
143 | + close: function () { | ||
144 | + var th = this; | ||
145 | + var nav_b = th.selectComponent("#nav_b"); //组件的id | ||
146 | + nav_b.close_box(); | ||
65 | } | 147 | } |
66 | }) | 148 | }) |
67 | \ No newline at end of file | 149 | \ No newline at end of file |