tment_details.js
3.42 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
var e = getApp(),
a = e.globalData.setting,
os = a,
t = e.request,
d = e.globalData;
Page({
/**
* 页面的初始数据
*/
data: {
url: a.url,
iurl: a.imghost,
tment_details: [], //预约详情
number: "", //订单号
arrangeTime: "", //预约年月日
day: "", //判断是上午还是下午
states: 3, //3为取消预约
},
//取消预约
cancel_tment: function(e) {
var th = this;
var my_confirm = th.selectComponent("#my_confirm"); //组件的id
my_confirm.open(
"确定取消?",
"取消",
"确定",
function() {
my_confirm.open_cancel(0);
},
function() {
var index = e.currentTarget.dataset.index;
var states = th.data.states;
var tment_details = th.data.tment_details;
var number = th.data.number;
var json = {
"number": number,
"storeId": a.stoid,
"states": states
};
var data = JSON.stringify(json);
var url = th.data.url + "/api/weshop/marketing/reservation/reservation/update"; //预约接口地址
wx.request({
url: url,
data: data,
method: 'put',
header: {
'content-type': 'application/json'
}, // 设置请求的 header
success: function(res) {
my_confirm.open_cancel(0);
if (res.data.code == 0) {
getApp().my_warnning("取消成功", 1, th);
var start = 'tment_details[' + 0 + '].State';
th.setData({
[start]: 3
})
} else {
getApp().my_warnning(res.data.msg, 0, th);
}
}
})
}
);
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
console.log("预约详情");
console.log(options);
var th = this;
th.setData({
options,
number: options.number
})
},
//查询美容师详情
query_bea: function() {
var th = this;
var number = th.data.number;
var url = "/api/weshop/marketing/reservation/reservation/page";
getApp().request.promiseGet(url, {
data: {
storeId: a.stoid,
userId: th.data.options.userid,
number: number
}
}).then(res => {
wx.hideLoading();
if (res.data.code == 0) {
var data = res.data.data.pageData;
var arrangeTime = data[0].ArrangeTime.substring(0, 11);
var day = data[0].ArrangeTime.substring(11, 16);
th.setData({
tment_details: data,
arrangeTime: arrangeTime,
day: day
})
} else {
getApp().my_warnning(res.data.msg, 0, th);
}
})
},
//显示核销码
code_show: function(e) {
var th = this;
//--获取成功的时候--
var no = e.currentTarget.dataset.order_sn;
var qc_com = th.selectComponent("#qc_com"); //组件的id
var obj = {
val: no,
content: "请将二维码展示给核销员,使用更快捷"
};
qc_com.open(obj)
},
//跳到首页
goto: function(e) {
var th = this;
wx.navigateTo({
url: '/pages/index/index/index',
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
var th = this;
th.query_bea();
},
//关闭导航
close: function () {
var th = this;
var nav_b = th.selectComponent("#nav_b"); //组件的id
nav_b.close_box();
}
})