addCheckDining.js
3.11 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
// pack-book/pages/reservation/addCheckDining.js
import util from '../../../utils/util';
import App from '../../../utils/api';
Page({
/**
* 页面的初始数据
*/
data: {
id: '', //订单id
currentLength: 0, //备注输入长度
selectedValue: '', //选择的核餐类型
desc: '', //核餐备注
checkmeals: [], //核餐列表
status: [{
value: '1',
text: '已确认',
checked: true,
}, {
value: '2',
text: '未接通',
checked: false,
}, {
value: '3',
text: '待定',
checked: false,
}],
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
id: options.id
});
this.getInfo()
},
// 获取核餐列表
getInfo() {
App.Reserve.GetReserveDetailDataSet({
rid: this.data.id,
}).then(res => {
let checkmeals = res.data.reserve_recheck_info; //核餐
checkmeals.forEach(i => {
i.cdateTime = util.unixtoTime(i.cdate, "YYYY-MM-DD HH:II:SS")
i.typeStr = i.type == '1' ? '已确认' : i.type == '2' ? '未接通' : i.type == '3' ? '待定' : '';
})
this.setData({
checkmeals
})
})
},
// 添加核餐
getDzSellerConfFun() {
App.Reserve.CreateReserveRecheck({
rid: this.data.id,
uid: util.cache('seller_user')['id'],
type: this.data.selectedValue,
desc: this.data.desc,
}).then(res => {
if (res.ret == 200) {
util.toast('添加成功!', 'none')
setTimeout(() => {
wx.navigateBack(1)
}, 500);
} else {
util.toast('添加失败!', 'none')
}
})
},
// 选择核餐类型
radioChange(e) {
const selectedValue = e.currentTarget.dataset.value;
const updatedStatus = this.data.status.map(item => ({
...item,
checked: item.value === selectedValue
}));
this.setData({
status: updatedStatus,
selectedValue
});
},
// 输入备注
onInput(e) {
const value = e.detail.value;
this.setData({
currentLength: value.length,
desc: value,
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})